Binding function to event
Listening to events become simple with decorators
Binding to events
Socket events by namespace
Listening to socket events become simple with @SocketOn decorator
event
- The event name
namespace
- The related namespace which the socket should be related to.
middlewares
- 0...n arguments of middleware functions which should occur before the event callback function.
This decorator registers the function as a callback for an event. In case middlewares functions were passed, those methods will occur right before the callback function.
Example
You can bind one function to multiple events by use multiple @SocketOn
decorators.
Server events by namespace
Listening to Socket events become simple with @SocketServerOn decorator
event
- The event name
namespace
- The related namespace which the socket should be related to.
middlewares
- 0...n arguments of middleware functions which should occur before the event callback function.
This decorator registers the function as a callback for an event. In case middlewares functions were passed, those methods will occur right before the callback function.
Example
You can bind one function to multiple events by use multiple @SocketServerOn
decorators.
Last updated