Middlewares
Chain middlewares per socket event
Event level middleware
SugoiJS gives the ability to chain middlewares on event level by the @SocketOn
, @SocketOnByHandler
, @SocketServerOn
and @SocketServerOnByHandler
decorators
Setting a middleware
Each of the decorators get as many middlewares as you specify, those middlewares will apply in the same order you passed the.
Example
Break the middleware chain
Since middlewares are sequential, you can use them to verify the data and break the flow whenever is needed.
By using the BreakMiddleware
method
reason
- The data which should be added to the exception.
Example
Last updated