A simple chat or "shoutbox" based on WebSockets, pure Javascript, and Python.
No images; No CSS classes; no Javascript framework; no backend dependencies. Pure HTML, CSS3, Javascript and Python. Requires a modern browser (particularly IE10+).
It adapts to a fluid design, allows username selection (handling username collisions), provides rate limiting and spam control (users can ignore particular commenters), etc.
The frontend can be easily adapted to your preferred Javascript framework, including jQuery. The lack of CSS classes means there will be minimum interference with your existing stylesheets.
The backend is a custom, multi-threaded, asynchronous (non-blocking) HTTP/WebSockets server (RFC-2616/RFC-6455) written in pure Python. It's however very limited and untested, and should be ported to a real server for production use. It can also be adapted to your programming language of choice using the original code as a guide.
I've developed Shout! to learn about WebSockets and low-level networking in Python, and I've commented the code to guide you through my steps.
For your convenience the entire project is contained in only two files: a .html for the frontend and a .py for the backend.
Feel free to use, edit, or distribute this code in any way you want. Check out the GitHub repository; your contributions will be more than welcome.
- Download shout.html and shout.py and place them in the same folder
- Execute shout.py
- Navigate to /localhost in your preferred browser(s)