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

Method callback

packages/engine.io/lib/userver.ts:132–157  ·  view source on GitHub ↗
(errorCode, errorContext)

Source from the content-addressed store, hash-verified

130 req.res = res;
131
132 const callback = (errorCode, errorContext) => {
133 if (errorCode !== undefined) {
134 this.emit("connection_error", {
135 req,
136 code: errorCode,
137 message: Server.errorMessages[errorCode],
138 context: errorContext,
139 });
140 this.abortRequest(req.res, errorCode, errorContext);
141 return;
142 }
143
144 if (req._query.sid) {
145 debug("setting new request for existing client");
146 // @ts-ignore
147 this.clients[req._query.sid].transport.onRequest(req);
148 } else {
149 const closeConnection = (errorCode, errorContext) =>
150 this.abortRequest(res, errorCode, errorContext);
151 this.handshake(
152 req._query.transport,
153 req as unknown as EngineRequest,
154 closeConnection,
155 );
156 }
157 };
158
159 this._applyMiddlewares(req, res, (err) => {
160 if (err) {

Callers

nothing calls this directly

Calls 11

abortRequestMethod · 0.95
createTransportMethod · 0.95
debugFunction · 0.85
_maybeUpgradeMethod · 0.80
writeStatusMethod · 0.80
keysMethod · 0.80
writeHeaderMethod · 0.80
emitMethod · 0.65
onRequestMethod · 0.45
closeMethod · 0.45
getHeaderMethod · 0.45

Tested by

no test coverage detected