* Registers a middleware, which is a function that gets executed for every incoming {@link Socket}. * * @example * io.use((socket, next) => { * // ... * next(); * }); * * @param fn - the middleware function
(
fn: (
socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>,
next: (err?: ExtendedError) => void,
) => void,
)
| 862 | * @param fn - the middleware function |
| 863 | */ |
| 864 | public use( |
| 865 | fn: ( |
| 866 | socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>, |
| 867 | next: (err?: ExtendedError) => void, |
| 868 | ) => void, |
| 869 | ): this { |
| 870 | this.sockets.use(fn); |
| 871 | return this; |
| 872 | } |
| 873 | |
| 874 | /** |
| 875 | * Targets a room when emitting. |
no outgoing calls
no test coverage detected