import { Namespace } from "https://deno.land/x/socket_io@0.2.0/packages/socket.io/lib/namespace.ts";
Sends a message to the other Socket.IO servers of the cluster.
Examples
const myNamespace = io.of("/my-namespace");
const myNamespace = io.of("/my-namespace");
myNamespace.serverSideEmit("hello", "world");
myNamespace.on("hello", (arg1) => { console.log(arg1); // prints "world" });
// acknowledgements (without binary content) are supported too: myNamespace.serverSideEmit("ping", (err, responses) => { if (err) { // some clients did not acknowledge the event in the given delay } else { console.log(responses); // one response per client } });
myNamespace.on("ping", (cb) => { cb("pong"); });
Type Parameters
Ev extends EventNames<ServerSideEvents>
Parameters
...args: EventParams<ServerSideEvents, Ev>
- an array of arguments, which may include an acknowledgement callback at the end