Hi,
I'm trying to use websockets with gevent, and a bit stuck with non-blocking
api.
I don't need to read from websocket for now, but rather only send events to
the browser, when there is new information on the server.
I tried doing it first with greenlets, e.g. something like
reader_dead = gevent.Event()
def reader():
try:
while True:
msg = uwsgi.websocket_recv()
if msg:
logging.info('Received %s', msg)
except:
reader_dead.set()
raise
def writer():
while not reader_dead.is_set():
data = wait_for_new_data(timeout=None)
uwsgi.websocket_send(data)
gevent.spawn(writer)
gevent.spawn(reader).join()
but uwsgi complains, that the API functions should be called from the main
executable.
Should I write the same code in non-blocking style? How can I do that? I
don't understand non-blocking well enough to write this quickly
Thanks!
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi