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

Method onRequest

packages/engine.io/lib/transports/polling.ts:51–64  ·  view source on GitHub ↗

* Overrides onRequest. * * @param {EngineRequest} req * @package

(req: EngineRequest)

Source from the content-addressed store, hash-verified

49 * @package
50 */
51 onRequest(req: EngineRequest) {
52 const res = req.res;
53 // remove the reference to the ServerResponse object (as the first request of the session is kept in memory by default)
54 req.res = null;
55
56 if ("GET" === req.method) {
57 this.onPollRequest(req, res);
58 } else if ("POST" === req.method) {
59 this.onDataRequest(req, res);
60 } else {
61 res.writeHead(500);
62 res.end();
63 }
64 }
65
66 /**
67 * The client sends a request awaiting for us to send data.

Callers 4

callbackMethod · 0.45
handshakeFunction · 0.45
callbackMethod · 0.45
onSuccessFunction · 0.45

Calls 4

onPollRequestMethod · 0.95
onDataRequestMethod · 0.95
writeHeadMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected