Unfortunately, my two different example apps require two entirely different stacks---one which has few dependencies and is easy to run on the command line, and one which is a much more fully featured production example that is fun to play around with.
The Python library support for websockets continues to evolve very quickly.
Slides are online here.
# activate Python 3 venv
source bin/activate
# install dependencies (there aren't many)
pip install -r requirements.txt
# start up the server
python ws_server.py
# start packet capture
sudo tcpdump -i lo -s0 tcp port 8765 -w output.dump
# start up the client and interact
python ws_client.py
# kill your tcpdump and server when you're done :)
cd socketio
source bin/activate
# la la la wait for gevent to compile...
pip install -r requirements.txt
# start the server
python chat_server.py
# proxy behind nginx for production-like environment
cd browserquest
vagrant up
# wait patiently...
vagrant ssh
cd /vagrant/src && node server/js/main.js
# go to 192.168.33.10 in a browser and play!
- Mozilla & Little Workshop, the folks behind http://browserquest.mozilla.org/
- https://openclipart.org/ (web server clipart)
- http://www.wikipedia.org/ (various images and background info)
- Slides were created with https://www.haikudeck.com/ :)
- Browser support data from http://caniuse.com/websockets
- Average HTTP header size from http://dev.chromium.org/spdy/spdy-whitepaper
- Beej's Guide to Network Programming: http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#theory and Beej's Guide to UNIX IPC: http://beej.us/guide/bgipc/output/html/multipage/unixsock.html