A proof of concept echo server, used to demonstrate Python/Rust interop using websockets as the transport. The interop is achieved through CFFI and uses the Milksnake setup tool to generate Python extension modules and headers.
Create a virtual environment:
$ python3.6 -m venv venv
$ . venv/bin/activate
(venv) $
Install papryus:
(venv) $ pip install . -v --editable
Run papyrus:
(venv) python -m papyrus
Install the websocket-client
package and spin up a Python interpreter in
another terminal:
>>> from websocket import create_connection
>>> ws = create_connection("ws://localhost:8888/echo")
>>> ws.send("To Rust and back again!")
29
>>> ws.recv()
'To Rust and back again!'
>>> ws.close()
In the papyrus terminal you should see:
Websocket opened
Websocket closed