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

Emits to all connected clients.

Examples

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

myNamespace.emit("hello", "world");

// all serializable datastructures are supported (no need to call JSON.stringify) myNamespace.emit("hello", 1, "2", { 3: ["4"], 5: Uint8Array.from([6]) });

// with an acknowledgement from the clients myNamespace.timeout(1000).emit("some-event", (err, responses) => { if (err) { // some clients did not acknowledge the event in the given delay } else { console.log(responses); // one response per client } });

Type Parameters

Ev extends EventNames<EmitEvents>

Parameters

ev: Ev
...args: EventParams<EmitEvents, Ev>

Returns

boolean

Always true