Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Latest
method Namespace.prototype.use
import { Namespace } from "https://deno.land/x/socket_io@0.2.0/packages/socket.io/lib/namespace.ts";

Registers a middleware, which is a function that gets executed for every incoming Socket.

Examples

const myNamespace = io.of("/my-namespace");

myNamespace.use(async (socket) => { // ... });

Parameters

fn: (socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>) => Promise<void>
  • the middleware function