I propose that user-supplied lifecycle functions should be called on useful events like socket CONNECT and DISCONNECT events. This will allow users of this library to execute any application logic necessary when these events occur.
For example, when the socketio client disconnects and reconnects, there may be some application logic needed to reset state or renegotiate with the server (there will be a new session id issued upon the new connection as well).
I can go ahead and put a PR up for this soon--let me know if this is something that makes sense to you! I was thinking of something simple like:
I propose that user-supplied lifecycle functions should be called on useful events like socket
CONNECT
andDISCONNECT
events. This will allow users of this library to execute any application logic necessary when these events occur.For example, when the socketio client disconnects and reconnects, there may be some application logic needed to reset state or renegotiate with the server (there will be a new session id issued upon the new connection as well).
I can go ahead and put a PR up for this soon--let me know if this is something that makes sense to you! I was thinking of something simple like: