Chat Room

Disconnected
👤 ? Users Online

    Setup your chat user

    Preview:

    DevOpsy Stuff

    This chatroom uses socket.io for realtime messages between clients connected to the chatroom. Since my site uses gunicorn as a WSGI server with multiple workers, I had to split out the processes in my docker container to start two different pools of workers, both listening on different ports.

    • Main pool with multiple sync workers serving main site
    • Secondary pool with a single gevent worker handling socket.io connections

    Finally, I just adjusted my nginx config to route the correct requests to the corresponding ports in my docker container.

    • /: to main pool's port with multiple workers
    • /socket.io: to secondary pool's port with single gevent worker

    Javascript Frontend

    The frontend will only connect to the chatroom once you setup a username and color. This is handled by the popover event. We then save the username and color to the browser's local storage for future messages (but can be updated at any time).

    If you're interested, you can view the code below.