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

Method doWrite

packages/engine.io-client/lib/transports/websocket.node.ts:33–49  ·  view source on GitHub ↗
(packet: Packet, data: RawData)

Source from the content-addressed store, hash-verified

31 }
32
33 doWrite(packet: Packet, data: RawData) {
34 const opts: { compress?: boolean } = {};
35 if (packet.options) {
36 opts.compress = packet.options.compress;
37 }
38
39 if (this.opts.perMessageDeflate) {
40 const len =
41 // @ts-ignore
42 "string" === typeof data ? Buffer.byteLength(data) : data.length;
43 if (len < this.opts.perMessageDeflate.threshold) {
44 opts.compress = false;
45 }
46 }
47
48 this.ws.send(data, opts);
49 }
50}

Callers

nothing calls this directly

Calls 1

sendMethod · 0.45

Tested by

no test coverage detected