Simple python websocket example with Flask, gevent, gevent-websocket, originally described in this article by @socketubs, but I add a little improvement, the websocket server will echo your text.
run pip install -r requirements.txt
to install requirements, and start the server with python runserver.py
then browse http://localhost:8000/
to try out.