Ah, I see. Thank you for help.
On Monday, April 20, 2015 9:37 PM, Roberto De Ioris <[email protected]>
wrote:
> I see. The thing is is that I have another greenlet running that is
> listening through a zeromq port. And depending on what messages I get from
> it, I need to send a message to a certain client, and the server can have
> many clients connected to it. So the only way I can think of to do this is
> to store the websocket session in a dictionary so I can look up which
> client to send a message to. How can I accomplish this if I can't do it
> the way my example did?
>
the rule is that a different context (thread, process, greenlet) cannot
access the request/response session of another one. This enforces
transparent support for multiple paradigms.
The common approach is telling the greenlet/process/thread (once the
websocket session is established) to wait for some event (redis is a easy
way to accomplish it, but i suppose you can create a zeromq channel too).
When the "external" greenlet has something to send it simply enqueue a
message back to the channel of the right request context.
With this technique you can support multiple greenlet in multiple
processes too.
--
Roberto De Ioris
http://unbit.com
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi