MCPcopy Index your code
hub / github.com/SocketCluster/socketcluster-server / AGServerSocket

Function AGServerSocket

serversocket.js:23–157  ·  view source on GitHub ↗
(id, server, socket, protocolVersion)

Source from the content-addressed store, hash-verified

21const HANDSHAKE_REJECTION_STATUS_CODE = 4008;
22
23function AGServerSocket(id, server, socket, protocolVersion) {
24 AsyncStreamEmitter.call(this);
25
26 this.id = id;
27 this.server = server;
28 this.socket = socket;
29 this.state = this.CONNECTING;
30 this.authState = this.UNAUTHENTICATED;
31 this.protocolVersion = protocolVersion;
32
33 this._receiverDemux = new StreamDemux();
34 this._procedureDemux = new StreamDemux();
35
36 this.request = this.socket.upgradeReq;
37
38 this.inboundReceivedMessageCount = 0;
39 this.inboundProcessedMessageCount = 0;
40
41 this.outboundPreparedMessageCount = 0;
42 this.outboundSentMessageCount = 0;
43
44 this.cloneData = this.server.options.cloneData;
45
46 this.inboundMessageStream = new WritableConsumableStream();
47 this.outboundPacketStream = new WritableConsumableStream();
48
49 this.middlewareHandshakeStream = this.request[this.server.SYMBOL_MIDDLEWARE_HANDSHAKE_STREAM];
50
51 this.middlewareInboundRawStream = new WritableConsumableStream();
52 this.middlewareInboundRawStream.type = this.server.MIDDLEWARE_INBOUND_RAW;
53
54 this.middlewareInboundStream = new WritableConsumableStream();
55 this.middlewareInboundStream.type = this.server.MIDDLEWARE_INBOUND;
56
57 this.middlewareOutboundStream = new WritableConsumableStream();
58 this.middlewareOutboundStream.type = this.server.MIDDLEWARE_OUTBOUND;
59
60 if (this.request.connection) {
61 this.remoteAddress = this.request.connection.remoteAddress;
62 this.remoteFamily = this.request.connection.remoteFamily;
63 this.remotePort = this.request.connection.remotePort;
64 } else {
65 this.remoteAddress = this.request.remoteAddress;
66 this.remoteFamily = this.request.remoteFamily;
67 this.remotePort = this.request.remotePort;
68 }
69 if (this.request.forwardedForAddress) {
70 this.forwardedForAddress = this.request.forwardedForAddress;
71 }
72
73 this.isBufferingBatch = false;
74 this.isBatching = false;
75 this.batchOnHandshake = this.server.options.batchOnHandshake;
76 this.batchOnHandshakeDuration = this.server.options.batchOnHandshakeDuration;
77 this.batchInterval = this.server.options.batchInterval;
78 this._batchBuffer = [];
79
80 this._batchingIntervalId = null;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…