I'm using long polling for a chat with gevent. I'm using Event.wait() when waiting for new messages to be posted on the chat.
I would like to handle the occasion a client disconnects with some functionality:
e.g. Return "client has disconnected" as a message for other chat users
Is this possible? =)
This depends on which WSGI server you use. AFAIK gevent.wsgi will not notify your handler in any way when the client closes the connection, because libevent-http does not do that. However, with gevent.pywsgi it should be possible. You'll probably need to start an additional greenlet to monitor the socket condition and somehow notify the greenlet that runs the handler, e.g. by killing it. I could be missing an easier way to do this though.