MCPcopy
hub / github.com/socketio/socket.io / broadcast

Function broadcast

packages/socket.io-adapter/lib/cluster-adapter.ts:427–446  ·  view source on GitHub ↗
(packet: any, opts: BroadcastOptions)

Source from the content-addressed store, hash-verified

425 }
426
427 override async broadcast(packet: any, opts: BroadcastOptions) {
428 const onlyLocal = opts.flags?.local;
429
430 if (!onlyLocal) {
431 try {
432 const offset = await this.publishAndReturnOffset({
433 type: MessageType.BROADCAST,
434 data: {
435 packet,
436 opts: encodeOptions(opts),
437 },
438 });
439 this.addOffsetIfNecessary(packet, opts, offset);
440 } catch (e) {
441 debug("[%s] error while broadcasting message: %s", this.uid, e.message);
442 }
443 }
444
445 super.broadcast(packet, opts);
446 }
447
448 /**
449 * Adds an offset at the end of the data array in order to allow the client to receive any missed packets when it

Callers

nothing calls this directly

Calls 3

encodeOptionsFunction · 0.85
debugFunction · 0.85
broadcastMethod · 0.45

Tested by

no test coverage detected