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

Method constructor

packages/engine.io/lib/transports/websocket.ts:17–29  ·  packages/engine.io/lib/transports/websocket.ts::WebSocket.constructor

* WebSocket transport * * @param {EngineRequest} req

(req: EngineRequest)

Source from the content-addressed store, hash-verified

15 * @param {EngineRequest} req
16 */
17 constructor(req: EngineRequest) {
18 super(req);
19 this.socket = req.websocket;
20 this.socket.on(class="st">"message", (data, isBinary) => {
21 const message = isBinary ? data : data.toString();
22 debug(class="st">'received "%s"', message);
23 super.onData(message);
24 });
25 this.socket.once(class="st">"close", this.onClose.bind(this));
26 this.socket.on(class="st">"error", this.onError.bind(this));
27 this.writable = true;
28 this.perMessageDeflate = null;
29 }
30
31 /**
32 * Transport name

Callers

nothing calls this directly

Calls 4

debugFunction · 0.85
bindMethod · 0.80
onMethod · 0.45
onDataMethod · 0.45

Tested by

no test coverage detected