To run:
python3 -m pip install websockets
python3 simple_websocket_server.py
Then in another terminal, run
python3 -m http.server
Open a web browser and navigate to http://localhost:8000/index.html.
Note that after 10 seconds, we get rid of the reference to the websocket object (both via setting it to null
as well as delete
-ing the property). Despite this, the connection is unbroken and the messages keep coming.