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

Method _packet

packages/socket.io/lib/client.ts:220–229  ·  view source on GitHub ↗

* Writes a packet to the transport. * * @param {Object} packet object * @param {Object} opts * @private

(packet: Packet | Packet[], opts: WriteOptions = {})

Source from the content-addressed store, hash-verified

218 * @private
219 */
220 _packet(packet: Packet | Packet[], opts: WriteOptions = {}): void {
221 if (this.conn.readyState !== "open") {
222 debug("ignoring packet write %j", packet);
223 return;
224 }
225 const encodedPackets = opts.preEncoded
226 ? (packet as Packet[]) // previous versions of the adapter incorrectly used socket.packet() instead of writeToEngine()
227 : this.encoder.encode(packet as Packet);
228 this.writeToEngine(encodedPackets, opts);
229 }
230
231 private writeToEngine(
232 encodedPackets: Array<string | Buffer>,

Callers 3

connectMethod · 0.95
packetMethod · 0.45
socket.io.jsFile · 0.45

Calls 3

writeToEngineMethod · 0.95
debugFunction · 0.85
encodeMethod · 0.65

Tested by

no test coverage detected