Closed andrezzoid closed 8 years ago
Those options already take a function.
onConnection
- a function with the signaturefunction(socket)
invoked for each incoming client connection where:
socket
- the Socket object of the incoming connection.onDisconnection
- a function with the signaturefunction(socket)
invoked for each incoming client connection on disconnect where:socket
- the Socket object of the connection.
I know that. I was suggesting they could have a callback, like function(socket, callback)
in case you needed to acess the DB or any other kind of long operation for each socket connection.
It should not matter if you need to make async calls because you are not returning a value here. It's not like if you delayed the callback from returning it will have any impact. This is an event, not an interaction.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
Would be great if plugin options
onConnection
andonDisconnection
could have callbacks, for instance, if one needs to make a database read/write on each socket connection.