This has been done countless times already.. I did my own to learn more about websockets and to keep it dead simple and stripped down. My goal was to make it easy to integrate into something like a initializr.com template.
Built using input from blogs, stackoverflow, etc:
- http://stackoverflow.com/questions/323972/is-there-any-way-to-kill-a-thread-in-python
- http://blog.miguelgrinberg.com/post/easy-websockets-with-flask-and-gevent
- http://www.alexhadik.com/blog/2015/1/29/using-socketio-with-python-and-flask-on-heroku
Can also have flask-socketio package up the data as JSON. More info: