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

Method callback

packages/engine.io/lib/server.ts:791–817  ·  view source on GitHub ↗
(errorCode, errorContext)

Source from the content-addressed store, hash-verified

789 engineRequest.res = res;
790
791 const callback: ErrorCallback = (errorCode, errorContext) => {
792 if (errorCode !== undefined) {
793 this.emit("connection_error", {
794 req: engineRequest,
795 code: errorCode,
796 message: Server.errorMessages[errorCode],
797 context: errorContext,
798 });
799 abortRequest(res, errorCode, errorContext);
800 return;
801 }
802
803 if (engineRequest._query.sid) {
804 debug("setting new request for existing client");
805 this.clients[engineRequest._query.sid].transport.onRequest(
806 engineRequest,
807 );
808 } else {
809 const closeConnection = (errorCode, errorContext) =>
810 abortRequest(res, errorCode, errorContext);
811 this.handshake(
812 engineRequest._query.transport as TransportName,
813 engineRequest,
814 closeConnection,
815 );
816 }
817 };
818
819 this._applyMiddlewares(engineRequest, res, (err) => {
820 if (err) {

Callers

nothing calls this directly

Calls 8

onWebSocketMethod · 0.95
abortRequestFunction · 0.85
debugFunction · 0.85
abortUpgradeFunction · 0.85
emitMethod · 0.65
onRequestMethod · 0.45
writeHeadMethod · 0.45
handleUpgradeMethod · 0.45

Tested by

no test coverage detected