MCPcopy Index your code
hub / github.com/socketio/socket.io / use

Method use

lib/index.ts:776–784  ·  view source on GitHub ↗

* 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
  )

Source from the content-addressed store, hash-verified

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.

Callers 15

socket.tsFile · 0.45
middleware.tsFile · 0.45
namespaces.tsFile · 0.45
index.jsFile · 0.45
index.jsFile · 0.45
index.tsFile · 0.45
index.jsFile · 0.45
main.jsFile · 0.45
index.jsFile · 0.45
index.tsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected