* Registers a middleware, which is a function that gets executed for every incoming Socket. * * @example * io.use((socket, next) => { * // ... * next(); * }); * * @param fn - the middleware function
(
fn: (
socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>,
next: (err?: ExtendedError) => void
) => void
)
| 774 | * @param fn - the middleware function |
| 775 | */ |
| 776 | public use( |
| 777 | fn: ( |
| 778 | socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>, |
| 779 | next: (err?: ExtendedError) => void |
| 780 | ) => void |
| 781 | ): this { |
| 782 | this.sockets.use(fn); |
| 783 | return this; |
| 784 | } |
| 785 | |
| 786 | /** |
| 787 | * Targets a room when emitting. |
no outgoing calls
no test coverage detected