pioneers / runtime

Firmware for the PiE kit robots and devices
7 stars 2 forks source link

[NET_HANDLER] Accept WebSocket connections in addition to normal TCP sockets #240

Open levincent06 opened 3 years ago

levincent06 commented 3 years ago

Dawn will be implementing a browser-based application, which will communicate with WebSockets instead of TCP sockets. We need to support browser-Dawn in addition to desktop app Dawn.

Here is an explanation for the difference between WebSockets and normal sockets: https://stackoverflow.com/q/4973622 (tl;dr WebSockets are built on top of TCP sockets) Here is a small library that we can use: https://theldus.github.io/wsServer/

benliao1 commented 3 years ago

We may be rehashing the implementation of this. We will probably use the Python websocket library and start a new process, like websocket_server.py, which connects to localhost:RASPI_TCP_PORT on one end and a new websocket server on the other end and just ferries messages between the two. We might even be able to support both web browser Dawn and electron app Dawn simultaneously with this design.

AVSurfer123 commented 3 years ago

We will be using this library for Python https://websockets.readthedocs.io/en/stable/