SocketHandler
class provides us the right method for achieving this approachsocket.on(event,callback)
event
- The event we want to bind the callback to.
callback
- The callback method
middlewares
- 0...n functions which should apply before the callback apply.
namespace
- The namespace the event is related to (Default: "/")io.on(event,callback)
.event
- The event we want to bind the callback to.
callback
- The callback method
middlewares
- Array of 0...n functions which should apply before the callback apply.
namespace
- The namespace the event is related to (Default: "/")socket.removeListener(event,callbackToRemove)
event
- The event nameio.removeListener(event,callbackToRemove)
event
- The event name