Reputation: 31
Is there a solution to broadcast a message when my app is launched across multiple workers - for example using hypercorn?
I'm currently launching my app like this:
$ hypercorn -b 127.0.0.1:8000 -w 4 wsgi:app
But the documented solution is to keep the connected clients in memory, with no way to broadcast to others that subscribed to the same event.
Any ideas? I was thinking to use Redis to achieve this, but I would like a simpler solution.
Upvotes: 3
Views: 1099
Reputation: 7039
I don't think there is a simpler solution than Redis (or similar third party tool) for this.
It is possible to run Hypercorn with memory shared across the workers, but it isn't simple to setup. Start here if you want to try this. At some point though you may have workers across multiple machines, in which case shared memory no longer works.
Upvotes: 1