Hi, I still need to run it somewhere, are you suggesting to run it together with the websocket handling? So it would run in every offload thread?
In any case, once I have pulled a message from redis I still need to know how to send it to the correct websocket. Logically I would create a different queue for each websocket, so each websocket handler can listen to its own specific queue, and every message received is sent to the client. But the protocol specification defines one queue name websocket.receive and inside each message it has an id for the reply_channel which I should associate with a socket. So a consumer would need to get a message from redis, parse and identify which to socket to send the message. Currently the application decides the backend it wants to use, so I can't use the redis client of my choice since what I'm trying to implement is the protocol layer. Initially I wanted to use 'uwsgi.wait_fd_read(redis_fd)', but I couldn't figure how to get the fd from the redis the application is using, also I should support different backends the application is using, maybe I can have one implementation using the official API and one optimized using wait_fd_read if possible. So the API I have is basically a function channel_layer.receive_many(), even the reference implementation calls this in a closed loop with a sleep(0.05). Can I have something like this running on a separate thread on uwsgi? Thanks Avraham On Mon, Jan 9, 2017 at 10:19 PM, Mikko Ohtamaa <[email protected]> wrote: > > > On 9 January 2017 at 14:17, Avraham Serour <[email protected]> wrote: > >> I mean from redis, if the application decides to send a message to a user >> it is stored in the broker (right now in my first version I'm using redis), >> I need a consumer to check if there are messages available and direct them >> each to the correct socket. >> > > You can use async Redis driver https://github.com/ > jonathanslenders/asyncio-redis#pubsub-example > > > _______________________________________________ > 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
