Stateless and Proud in the Realtime World
lucumr.pocoo.org
lucumr.pocoo.org
I agree that this is the obvious way to do it. Each client has an id, it talks to the backend via a Redis queue and all the state is in the database, which the irc client never sees.
The irc client itself is written in Go, which means that we should really only ever need that one process for all the irc clients. If anyone wants more info I can write it up quickly.
I'd like to just point out that in regards to this article, the whole pub-sub pattern for handling realtime web applications applies not only to python, but to all languages and frameworks. Putting your core application logic behind a pubsub channel is an excellent way to maintain a stateless architecture for large applications while keeping complexity low.
https://gist.github.com/8d233bfa42b0d131a19c
Flask and gevent are an excellent combination for realtime web.
It does seem to me like this separation is the right way to handle the problem.
There's obviously times where this approach makes no sense. But for any large application that involves both realtime sockets as well as traditional HTTP requests it's a great way to make things easier on yourself down the road. No need to have a separate codebase or server for your realtime application.