MCPcopy Index your code
hub / github.com/socketio/socket.io / _packet

Method _packet

lib/client.ts:219–228  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

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

Callers 2

connectMethod · 0.95
packetMethod · 0.45

Calls 2

writeToEngineMethod · 0.95
encodeMethod · 0.45

Tested by

no test coverage detected