@socket-mesh/server 18.1.4 → 19.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/broker/broker-events.d.ts +4 -4
- package/dist/broker/broker.d.ts +10 -10
- package/dist/broker/broker.js +2 -1
- package/dist/broker/exchange-client.d.ts +1 -1
- package/dist/broker/exchange.d.ts +6 -1
- package/dist/broker/exchange.js +6 -1
- package/dist/broker/index.d.ts +5 -0
- package/dist/broker/index.js +5 -0
- package/dist/broker/simple-broker.d.ts +8 -8
- package/dist/broker/simple-broker.js +26 -23
- package/dist/broker/simple-exchange.d.ts +6 -7
- package/dist/broker/simple-exchange.js +18 -14
- package/dist/events/index.d.ts +49 -0
- package/dist/handlers/authenticate.d.ts +11 -11
- package/dist/handlers/authenticate.js +31 -28
- package/dist/handlers/handshake.d.ts +2 -2
- package/dist/handlers/handshake.js +21 -16
- package/dist/handlers/index.d.ts +7 -0
- package/dist/handlers/index.js +7 -0
- package/dist/handlers/publish.d.ts +3 -3
- package/dist/handlers/publish.js +2 -2
- package/dist/handlers/remove-auth-token.d.ts +4 -4
- package/dist/handlers/server-request-handler.d.ts +6 -7
- package/dist/handlers/subscribe.d.ts +3 -3
- package/dist/handlers/subscribe.js +3 -3
- package/dist/handlers/unsubscribe.d.ts +2 -2
- package/dist/handlers/unsubscribe.js +2 -2
- package/dist/index.d.ts +20 -18
- package/dist/index.js +19 -20
- package/dist/plugin/server-plugin.d.ts +23 -25
- package/dist/server-options.d.ts +14 -11
- package/dist/server-socket.d.ts +68 -19
- package/dist/server-socket.js +27 -8
- package/dist/server-transport.d.ts +33 -23
- package/dist/server-transport.js +59 -50
- package/dist/server.d.ts +89 -90
- package/dist/server.js +110 -79
- package/package.json +46 -17
- package/dist/server-event.d.ts +0 -49
- /package/dist/{server-event.js → events/index.js} +0 -0
package/dist/server-transport.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import base64id from
|
|
4
|
-
export class ServerTransport extends
|
|
1
|
+
import { abortRequest, BaseSocketTransport, toError } from '@socket-mesh/core';
|
|
2
|
+
import { AuthError, BrokerError, InvalidActionError, SocketProtocolErrorStatuses } from '@socket-mesh/errors';
|
|
3
|
+
import base64id from 'base64id';
|
|
4
|
+
export class ServerTransport extends BaseSocketTransport {
|
|
5
|
+
id;
|
|
6
|
+
plugins;
|
|
7
|
+
request;
|
|
8
|
+
service;
|
|
9
|
+
type;
|
|
5
10
|
constructor(options) {
|
|
6
11
|
super(options);
|
|
7
12
|
this.type = 'server';
|
|
8
13
|
this.request = options.request;
|
|
9
|
-
this.plugins = options.plugins;
|
|
14
|
+
this.plugins = options.plugins || [];
|
|
10
15
|
this.service = options.service;
|
|
11
16
|
this.webSocket = options.socket;
|
|
12
17
|
this.id = (options.id || base64id.generateId());
|
|
@@ -17,38 +22,41 @@ export class ServerTransport extends SocketTransport {
|
|
|
17
22
|
if (this.signedAuthToken) {
|
|
18
23
|
const authToken = this.authToken;
|
|
19
24
|
const signedAuthToken = this.signedAuthToken;
|
|
20
|
-
this.socket.server.emit('socketAuthStateChange', { socket: this.socket, wasAuthenticated: true
|
|
25
|
+
this.socket.server.emit('socketAuthStateChange', { isAuthenticated: false, socket: this.socket, wasAuthenticated: true });
|
|
21
26
|
await super.changeToUnauthenticatedState();
|
|
22
|
-
this.socket.server.emit('socketDeauthenticate', { socket: this.socket
|
|
27
|
+
this.socket.server.emit('socketDeauthenticate', { authToken, signedAuthToken, socket: this.socket });
|
|
23
28
|
return true;
|
|
24
29
|
}
|
|
25
30
|
return false;
|
|
26
31
|
}
|
|
27
|
-
handleInboudMessage({ packet, timestamp }) {
|
|
32
|
+
async handleInboudMessage({ packet, timestamp }) {
|
|
28
33
|
if ((packet === null || typeof packet !== 'object') && this.socket.server.strictHandshake && this.status === 'connecting') {
|
|
29
34
|
this.disconnect(4009);
|
|
30
35
|
return;
|
|
31
36
|
}
|
|
32
|
-
return super.handleInboudMessage({ packet, timestamp });
|
|
37
|
+
return await super.handleInboudMessage({ packet, timestamp });
|
|
38
|
+
}
|
|
39
|
+
invoke(methodOptions, arg) {
|
|
40
|
+
return super.invoke(methodOptions, arg);
|
|
33
41
|
}
|
|
34
42
|
onClose(code, reason) {
|
|
35
43
|
const status = this.status;
|
|
36
|
-
const strReason = reason?.toString() ||
|
|
44
|
+
const strReason = reason?.toString() || SocketProtocolErrorStatuses[code];
|
|
37
45
|
super.onClose(code, reason);
|
|
38
|
-
this.socket.server.emit('socketClose', {
|
|
46
|
+
this.socket.server.emit('socketClose', { code, reason: strReason, socket: this.socket });
|
|
39
47
|
this.onDisconnect(status, code, strReason);
|
|
40
48
|
}
|
|
41
49
|
onDisconnect(status, code, reason) {
|
|
42
50
|
if (status === 'ready') {
|
|
43
|
-
this.socket.server.emit('socketDisconnect', { socket: this.socket
|
|
51
|
+
this.socket.server.emit('socketDisconnect', { code, reason, socket: this.socket });
|
|
44
52
|
}
|
|
45
53
|
else {
|
|
46
|
-
this.socket.server.emit('socketConnectAbort', { socket: this.socket
|
|
54
|
+
this.socket.server.emit('socketConnectAbort', { code, reason, socket: this.socket });
|
|
47
55
|
}
|
|
48
56
|
super.onDisconnect(status, code, reason);
|
|
49
57
|
if (this.socket.state.channelSubscriptions) {
|
|
50
58
|
const channels = Object.keys(this.socket.state.channelSubscriptions);
|
|
51
|
-
channels.map(
|
|
59
|
+
channels.map(channel => this.unsubscribe(channel));
|
|
52
60
|
}
|
|
53
61
|
if (this.streamCleanupMode !== 'none') {
|
|
54
62
|
(async () => {
|
|
@@ -61,7 +69,7 @@ export class ServerTransport extends SocketTransport {
|
|
|
61
69
|
}
|
|
62
70
|
for (let i = 0; i < this.plugins.length; i++) {
|
|
63
71
|
const plugin = this.plugins[i];
|
|
64
|
-
if (plugin
|
|
72
|
+
if (plugin?.onEnd) {
|
|
65
73
|
plugin.onEnd({ socket: this.socket, transport: this });
|
|
66
74
|
}
|
|
67
75
|
}
|
|
@@ -71,7 +79,7 @@ export class ServerTransport extends SocketTransport {
|
|
|
71
79
|
}
|
|
72
80
|
onError(error) {
|
|
73
81
|
super.onError(error);
|
|
74
|
-
this.socket.server.emit('socketError', { socket: this.socket
|
|
82
|
+
this.socket.server.emit('socketError', { error, socket: this.socket });
|
|
75
83
|
}
|
|
76
84
|
onInvoke(request) {
|
|
77
85
|
if (request.method !== '#publish') {
|
|
@@ -82,25 +90,25 @@ export class ServerTransport extends SocketTransport {
|
|
|
82
90
|
.then(() => {
|
|
83
91
|
super.onInvoke(request);
|
|
84
92
|
})
|
|
85
|
-
.catch(err => {
|
|
93
|
+
.catch((err) => {
|
|
86
94
|
abortRequest(request, err);
|
|
87
95
|
});
|
|
88
96
|
}
|
|
97
|
+
/*
|
|
98
|
+
protected override onPing(data: Buffer): void {
|
|
99
|
+
if (this.socket.server.strictHandshake && this.status === 'connecting') {
|
|
100
|
+
this.disconnect(4009);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
super.onPing(data);
|
|
105
|
+
this.socket.server.emit('socketPing', { socket: this.socket, data });
|
|
106
|
+
}
|
|
107
|
+
*/
|
|
89
108
|
onMessage(data, isBinary) {
|
|
90
|
-
this.socket.server.emit('socketMessage', { socket: this.socket
|
|
109
|
+
this.socket.server.emit('socketMessage', { data, isBinary, socket: this.socket });
|
|
91
110
|
super.onMessage(data, isBinary);
|
|
92
111
|
}
|
|
93
|
-
/*
|
|
94
|
-
protected override onPing(data: Buffer): void {
|
|
95
|
-
if (this.socket.server.strictHandshake && this.status === 'connecting') {
|
|
96
|
-
this.disconnect(4009);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
super.onPing(data);
|
|
101
|
-
this.socket.server.emit('socketPing', { socket: this.socket, data });
|
|
102
|
-
}
|
|
103
|
-
*/
|
|
104
112
|
onPingPong() {
|
|
105
113
|
if (this.socket.server.strictHandshake && this.status === 'connecting') {
|
|
106
114
|
this.disconnect(4009);
|
|
@@ -113,8 +121,8 @@ export class ServerTransport extends SocketTransport {
|
|
|
113
121
|
async onPublish(options) {
|
|
114
122
|
let data = options.data;
|
|
115
123
|
for (const plugin of this.plugins) {
|
|
116
|
-
if (
|
|
117
|
-
data = await plugin.onPublishOut({ socket: this.socket, transport: this
|
|
124
|
+
if (plugin.onPublishOut) {
|
|
125
|
+
data = await plugin.onPublishOut({ channel: options.channel, data, socket: this.socket, transport: this });
|
|
118
126
|
}
|
|
119
127
|
}
|
|
120
128
|
options.data = data;
|
|
@@ -135,7 +143,7 @@ export class ServerTransport extends SocketTransport {
|
|
|
135
143
|
}
|
|
136
144
|
onResponse(response) {
|
|
137
145
|
super.onResponse(response);
|
|
138
|
-
this.socket.server.emit('socketResponse', { socket: this.socket
|
|
146
|
+
this.socket.server.emit('socketResponse', { response, socket: this.socket });
|
|
139
147
|
}
|
|
140
148
|
onTransmit(request) {
|
|
141
149
|
if (request.method !== '#publish') {
|
|
@@ -146,7 +154,7 @@ export class ServerTransport extends SocketTransport {
|
|
|
146
154
|
.then(() => {
|
|
147
155
|
super.onTransmit(request);
|
|
148
156
|
})
|
|
149
|
-
.catch(err => {
|
|
157
|
+
.catch((err) => {
|
|
150
158
|
abortRequest(request, err);
|
|
151
159
|
});
|
|
152
160
|
}
|
|
@@ -174,9 +182,10 @@ export class ServerTransport extends SocketTransport {
|
|
|
174
182
|
signedAuthToken = await auth.signToken(authToken, options);
|
|
175
183
|
}
|
|
176
184
|
catch (err) {
|
|
177
|
-
|
|
178
|
-
this.
|
|
179
|
-
|
|
185
|
+
const error = toError(err);
|
|
186
|
+
this.onError(error);
|
|
187
|
+
this.disconnect(4002, error.toString());
|
|
188
|
+
throw error;
|
|
180
189
|
}
|
|
181
190
|
const changed = await super.setAuthorization(signedAuthToken, authToken);
|
|
182
191
|
if (changed && this.status === 'ready') {
|
|
@@ -187,23 +196,17 @@ export class ServerTransport extends SocketTransport {
|
|
|
187
196
|
await this.invoke('#setAuthToken', signedAuthToken)[0];
|
|
188
197
|
}
|
|
189
198
|
catch (err) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
error = new AuthError('Failed to confirm delivery of auth token to client due to malformatted error response');
|
|
196
|
-
}
|
|
197
|
-
this.onError(error);
|
|
198
|
-
throw error;
|
|
199
|
+
const authError = new AuthError(`Failed to deliver auth token to client - ${toError(err).message}`);
|
|
200
|
+
this.onError(authError);
|
|
201
|
+
throw authError;
|
|
199
202
|
}
|
|
200
|
-
return;
|
|
203
|
+
return changed;
|
|
201
204
|
}
|
|
202
205
|
try {
|
|
203
206
|
await this.transmit('#setAuthToken', signedAuthToken);
|
|
204
207
|
}
|
|
205
208
|
catch (err) {
|
|
206
|
-
if (err.name !== 'BadConnectionError') {
|
|
209
|
+
if (toError(err).name !== 'BadConnectionError') {
|
|
207
210
|
throw err;
|
|
208
211
|
}
|
|
209
212
|
}
|
|
@@ -211,7 +214,7 @@ export class ServerTransport extends SocketTransport {
|
|
|
211
214
|
}
|
|
212
215
|
setReadyStatus(pingTimeoutMs, authError) {
|
|
213
216
|
super.setReadyStatus(pingTimeoutMs, authError);
|
|
214
|
-
this.socket.server.emit('socketConnect', {
|
|
217
|
+
this.socket.server.emit('socketConnect', { authError, id: this.socket.id, isAuthenticated: !!this.signedAuthToken, pingTimeoutMs, socket: this.socket });
|
|
215
218
|
}
|
|
216
219
|
get socket() {
|
|
217
220
|
return super.socket;
|
|
@@ -219,10 +222,16 @@ export class ServerTransport extends SocketTransport {
|
|
|
219
222
|
set socket(value) {
|
|
220
223
|
super.socket = value;
|
|
221
224
|
}
|
|
225
|
+
transmit(serviceAndMethod, arg) {
|
|
226
|
+
return super.transmit(serviceAndMethod, arg);
|
|
227
|
+
}
|
|
222
228
|
triggerAuthenticationEvents(wasSigned, wasAuthenticated) {
|
|
229
|
+
if (!this.signedAuthToken) {
|
|
230
|
+
throw new AuthError('Signed auth token should be set to trigger authentication events');
|
|
231
|
+
}
|
|
223
232
|
super.triggerAuthenticationEvents(wasSigned, wasAuthenticated);
|
|
224
|
-
this.socket.server.emit('socketAuthStateChange', {
|
|
225
|
-
this.socket.server.emit('socketAuthenticate', {
|
|
233
|
+
this.socket.server.emit('socketAuthStateChange', { authToken: this.authToken, isAuthenticated: true, signedAuthToken: this.signedAuthToken, socket: this.socket, wasAuthenticated });
|
|
234
|
+
this.socket.server.emit('socketAuthenticate', { authToken: this.authToken, signedAuthToken: this.signedAuthToken, socket: this.socket, wasSigned });
|
|
226
235
|
}
|
|
227
236
|
async unsubscribe(channel) {
|
|
228
237
|
if (typeof channel !== 'string') {
|
package/dist/server.d.ts
CHANGED
|
@@ -1,119 +1,118 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AsyncStreamEmitter } from '@socket-mesh/async-stream-emitter';
|
|
2
|
+
import { AuthEngine } from '@socket-mesh/auth-engine';
|
|
3
|
+
import { ChannelMap } from '@socket-mesh/channels';
|
|
4
|
+
import { PrivateMethodMap, PublicMethodMap, ServiceMap, StreamCleanupMode } from '@socket-mesh/core';
|
|
5
|
+
import { CodecEngine } from '@socket-mesh/formatter';
|
|
6
|
+
import { DemuxedConsumableStream, StreamEvent } from '@socket-mesh/stream-demux';
|
|
2
7
|
import { Server as HttpServer } from 'http';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { ServerPlugin } from
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import { ServerOptions } from "./server-options.js";
|
|
11
|
-
import { Broker } from "./broker/broker.js";
|
|
12
|
-
import { Exchange } from "./broker/exchange.js";
|
|
13
|
-
import { ChannelMap } from "@socket-mesh/channels";
|
|
14
|
-
export declare class Server<TIncoming extends PublicMethodMap = {}, TChannel extends ChannelMap = {}, TService extends ServiceMap = {}, TOutgoing extends PublicMethodMap = {}, TPrivateIncoming extends PrivateMethodMap = {}, TPrivateOutgoing extends PrivateMethodMap = {}, TServerState extends object = {}, TState extends object = {}> extends AsyncStreamEmitter<ServerEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>> {
|
|
8
|
+
import { Broker } from './broker/broker.js';
|
|
9
|
+
import { Exchange } from './broker/exchange.js';
|
|
10
|
+
import { CloseEvent, ConnectionEvent, ErrorEvent, HandshakeEvent, HeadersEvent, ListeningEvent, ServerEvent, SocketAuthenticateEvent, SocketAuthStateChangeEvent, SocketBadAuthTokenEvent, SocketCloseEvent, SocketConnectEvent, SocketConnectingEvent, SocketDeauthenticateEvent, SocketDisconnectEvent, SocketErrorEvent, SocketMessageEvent, SocketPingEvent, SocketPongEvent, SocketRemoveAuthTokenEvent, SocketRequestEvent, SocketResponseEvent, SocketSubscribeEvent, SocketSubscribeFailEvent, SocketSubscribeStateChangeEvent, SocketUnsubscribeEvent, WarningEvent } from './events/index.js';
|
|
11
|
+
import { ServerPlugin } from './plugin/server-plugin.js';
|
|
12
|
+
import { ServerOptions } from './server-options.js';
|
|
13
|
+
import { ServerSocket } from './server-socket.js';
|
|
14
|
+
export declare class Server<TIncoming extends PublicMethodMap = {}, TOutgoing extends PublicMethodMap = {}, TChannel extends ChannelMap = {}, TService extends ServiceMap = {}, TState extends object = {}, TPrivateIncoming extends PrivateMethodMap = {}, TPrivateOutgoing extends PrivateMethodMap = {}, TServerState extends object = {}> extends AsyncStreamEmitter<ServerEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>> {
|
|
15
15
|
private readonly _callIdGenerator;
|
|
16
|
-
private
|
|
17
|
-
private _isReady;
|
|
16
|
+
private _handlers;
|
|
18
17
|
private _isListening;
|
|
18
|
+
private _isReady;
|
|
19
19
|
private _pingIntervalRef;
|
|
20
|
-
private
|
|
20
|
+
private readonly _wss;
|
|
21
21
|
ackTimeoutMs: number;
|
|
22
22
|
allowClientPublish: boolean;
|
|
23
|
-
pingIntervalMs: number;
|
|
24
|
-
isPingTimeoutDisabled: boolean;
|
|
25
|
-
origins: string;
|
|
26
|
-
pingTimeoutMs: number;
|
|
27
|
-
socketChannelLimit?: number;
|
|
28
|
-
strictHandshake: boolean;
|
|
29
23
|
readonly auth: AuthEngine;
|
|
30
24
|
readonly brokerEngine: Broker<TChannel>;
|
|
25
|
+
clientCount: number;
|
|
31
26
|
readonly clients: {
|
|
32
|
-
[id: string]: ServerSocket<TIncoming, TChannel, TService,
|
|
27
|
+
[id: string]: ServerSocket<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>;
|
|
33
28
|
};
|
|
34
|
-
clientCount: number;
|
|
35
29
|
readonly codecEngine: CodecEngine;
|
|
30
|
+
readonly httpServer: HttpServer;
|
|
31
|
+
isPingTimeoutDisabled: boolean;
|
|
32
|
+
origins: string;
|
|
33
|
+
pendingClientCount: number;
|
|
36
34
|
readonly pendingClients: {
|
|
37
|
-
[id: string]: ServerSocket<TIncoming, TChannel, TService,
|
|
35
|
+
[id: string]: ServerSocket<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>;
|
|
38
36
|
};
|
|
39
|
-
|
|
37
|
+
pingIntervalMs: number;
|
|
38
|
+
pingTimeoutMs: number;
|
|
39
|
+
readonly plugins: ServerPlugin<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>[];
|
|
40
|
+
socketChannelLimit?: number;
|
|
40
41
|
readonly socketStreamCleanupMode: StreamCleanupMode;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
addPlugin(...plugin: ServerPlugin<TIncoming, TChannel, TService, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>[]): void;
|
|
42
|
+
strictHandshake: boolean;
|
|
43
|
+
constructor(options?: ServerOptions<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>);
|
|
44
|
+
addPlugin(...plugin: ServerPlugin<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>[]): void;
|
|
45
45
|
private bind;
|
|
46
46
|
close(keepSocketsOpen?: boolean): Promise<void>;
|
|
47
|
+
emit(event: 'close', data: CloseEvent): void;
|
|
48
|
+
emit(event: 'connection', data: ConnectionEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
49
|
+
emit(event: 'error', data: ErrorEvent): void;
|
|
50
|
+
emit(event: 'headers', data: HeadersEvent): void;
|
|
51
|
+
emit(event: 'handshake', data: HandshakeEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
52
|
+
emit(event: 'listening', data: ListeningEvent): void;
|
|
53
|
+
emit(event: 'ready', data: {}): void;
|
|
54
|
+
emit(event: 'socketAuthStateChange', data: SocketAuthStateChangeEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
55
|
+
emit(event: 'socketAuthenticate', data: SocketAuthenticateEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
56
|
+
emit(event: 'socketBadAuthToken', data: SocketBadAuthTokenEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
57
|
+
emit(event: 'socketClose', data: SocketCloseEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
58
|
+
emit(event: 'socketConnect', data: SocketConnectEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
59
|
+
emit(event: 'socketConnectAbort', data: SocketDisconnectEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
60
|
+
emit(event: 'socketConnecting', data: SocketConnectingEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
61
|
+
emit(event: 'socketDeauthenticate', data: SocketDeauthenticateEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
62
|
+
emit(event: 'socketDisconnect', data: SocketDisconnectEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
63
|
+
emit(event: 'socketError', data: SocketErrorEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
64
|
+
emit(event: 'socketMessage', data: SocketMessageEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
65
|
+
emit(event: 'socketPing', data: SocketPingEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
66
|
+
emit(event: 'socketPong', data: SocketPongEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
67
|
+
emit(event: 'socketRemoveAuthToken', data: SocketRemoveAuthTokenEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
68
|
+
emit(event: 'socketRequest', data: SocketRequestEvent<TIncoming, TService, TPrivateIncoming>): void;
|
|
69
|
+
emit(event: 'socketResponse', data: SocketResponseEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
70
|
+
emit(event: 'socketSubscribe', data: SocketSubscribeEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
71
|
+
emit(event: 'socketSubscribeFail', data: SocketSubscribeFailEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
72
|
+
emit(event: 'socketSubscribeRequest', data: SocketSubscribeEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
73
|
+
emit(event: 'socketSubscribeStateChange', data: SocketSubscribeStateChangeEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
74
|
+
emit(event: 'socketUnsubscribe', data: SocketUnsubscribeEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>): void;
|
|
75
|
+
emit(event: 'warning', data: WarningEvent): void;
|
|
47
76
|
get exchange(): Exchange<TChannel>;
|
|
48
77
|
get isListening(): boolean;
|
|
49
78
|
get isReady(): boolean;
|
|
79
|
+
listen(): DemuxedConsumableStream<StreamEvent<ServerEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>>;
|
|
80
|
+
listen(event: 'close'): DemuxedConsumableStream<CloseEvent>;
|
|
81
|
+
listen(event: 'connection'): DemuxedConsumableStream<ConnectionEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
82
|
+
listen(event: 'error'): DemuxedConsumableStream<ErrorEvent>;
|
|
83
|
+
listen(event: 'handshake'): DemuxedConsumableStream<HandshakeEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
84
|
+
listen(event: 'headers'): DemuxedConsumableStream<HeadersEvent>;
|
|
85
|
+
listen(event: 'listening'): DemuxedConsumableStream<ListeningEvent>;
|
|
86
|
+
listen(event: 'ready'): DemuxedConsumableStream<{}>;
|
|
87
|
+
listen(event: 'socketAuthStateChange'): DemuxedConsumableStream<SocketAuthStateChangeEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
88
|
+
listen(event: 'socketAuthenticate'): DemuxedConsumableStream<SocketAuthenticateEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
89
|
+
listen(event: 'socketBadAuthToken'): DemuxedConsumableStream<SocketBadAuthTokenEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
90
|
+
listen(event: 'socketClose'): DemuxedConsumableStream<SocketCloseEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
91
|
+
listen(event: 'socketConnect'): DemuxedConsumableStream<SocketConnectEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
92
|
+
listen(event: 'socketConnectAbort'): DemuxedConsumableStream<SocketDisconnectEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
93
|
+
listen(event: 'socketConnecting'): DemuxedConsumableStream<SocketConnectingEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
94
|
+
listen(event: 'socketDeauthenticate'): DemuxedConsumableStream<SocketDeauthenticateEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
95
|
+
listen(event: 'socketDisconnect'): DemuxedConsumableStream<SocketDisconnectEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
96
|
+
listen(event: 'socketError'): DemuxedConsumableStream<SocketErrorEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
97
|
+
listen(event: 'socketMessage'): DemuxedConsumableStream<SocketMessageEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
98
|
+
listen(event: 'socketPing'): DemuxedConsumableStream<SocketPingEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
99
|
+
listen(event: 'socketPong'): DemuxedConsumableStream<SocketPongEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
100
|
+
listen(event: 'socketRemoveAuthToken'): DemuxedConsumableStream<SocketRemoveAuthTokenEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
101
|
+
listen(event: 'socketRequest'): DemuxedConsumableStream<SocketRequestEvent<TIncoming, TService, TPrivateIncoming>>;
|
|
102
|
+
listen(event: 'socketResponse'): DemuxedConsumableStream<SocketResponseEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
103
|
+
listen(event: 'socketSubscribe'): DemuxedConsumableStream<SocketSubscribeEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
104
|
+
listen(event: 'socketSubscribeFail'): DemuxedConsumableStream<SocketSubscribeFailEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
105
|
+
listen(event: 'socketSubscribeRequest'): DemuxedConsumableStream<SocketSubscribeEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
106
|
+
listen(event: 'socketSubscribeStateChange'): DemuxedConsumableStream<SocketSubscribeStateChangeEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
107
|
+
listen(event: 'socketUnsubscribe'): DemuxedConsumableStream<SocketUnsubscribeEvent<TIncoming, TOutgoing, TChannel, TService, TState, TPrivateIncoming, TPrivateOutgoing, TServerState>>;
|
|
108
|
+
listen(event: 'warning'): DemuxedConsumableStream<WarningEvent>;
|
|
50
109
|
private onClose;
|
|
51
110
|
private onConnection;
|
|
52
111
|
private onError;
|
|
53
112
|
private onHeaders;
|
|
54
113
|
private onListening;
|
|
55
|
-
private onUnhandledRequest;
|
|
56
114
|
private socketDisconnected;
|
|
57
115
|
private startPinging;
|
|
58
116
|
private stopPinging;
|
|
59
117
|
private verifyClient;
|
|
60
|
-
emit(event: "close", data: CloseEvent): void;
|
|
61
|
-
emit(event: "connection", data: ConnectionEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
62
|
-
emit(event: "error", data: ErrorEvent): void;
|
|
63
|
-
emit(event: "headers", data: HeadersEvent): void;
|
|
64
|
-
emit(event: "handshake", data: HandshakeEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
65
|
-
emit(event: "listening", data: ListeningEvent): void;
|
|
66
|
-
emit(event: "ready", data: {}): void;
|
|
67
|
-
emit(event: 'socketAuthStateChange', data: SocketAuthStateChangeEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
68
|
-
emit(event: 'socketAuthenticate', data: SocketAuthenticateEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
69
|
-
emit(event: 'socketBadAuthToken', data: SocketBadAuthTokenEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
70
|
-
emit(event: 'socketClose', data: SocketCloseEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
71
|
-
emit(event: 'socketConnect', data: SocketConnectEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
72
|
-
emit(event: 'socketConnectAbort', data: SocketDisconnectEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
73
|
-
emit(event: 'socketConnecting', data: SocketConnectingEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
74
|
-
emit(event: 'socketDeauthenticate', data: SocketDeauthenticateEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
75
|
-
emit(event: 'socketDisconnect', data: SocketDisconnectEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
76
|
-
emit(event: 'socketError', data: SocketErrorEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
77
|
-
emit(event: 'socketMessage', data: SocketMessageEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
78
|
-
emit(event: 'socketPing', data: SocketPingEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
79
|
-
emit(event: 'socketPong', data: SocketPongEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
80
|
-
emit(event: 'socketRemoveAuthToken', data: SocketRemoveAuthTokenEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
81
|
-
emit(event: 'socketRequest', data: SocketRequestEvent<TService, TIncoming, TPrivateIncoming>): void;
|
|
82
|
-
emit(event: 'socketResponse', data: SocketResponseEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
83
|
-
emit(event: 'socketSubscribe', data: SocketSubscribeEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
84
|
-
emit(event: 'socketSubscribeFail', data: SocketSubscribeFailEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
85
|
-
emit(event: 'socketSubscribeRequest', data: SocketSubscribeEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
86
|
-
emit(event: 'socketSubscribeStateChange', data: SocketSubscribeStateChangeEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
87
|
-
emit(event: 'socketUnsubscribe', data: SocketUnsubscribeEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>): void;
|
|
88
|
-
emit(event: "warning", data: WarningEvent): void;
|
|
89
|
-
listen(): DemuxedConsumableStream<StreamEvent<ServerEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>>;
|
|
90
|
-
listen(event: "close"): DemuxedConsumableStream<CloseEvent>;
|
|
91
|
-
listen(event: "connection"): DemuxedConsumableStream<ConnectionEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
92
|
-
listen(event: "error"): DemuxedConsumableStream<ErrorEvent>;
|
|
93
|
-
listen(event: "handshake"): DemuxedConsumableStream<HandshakeEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
94
|
-
listen(event: "headers"): DemuxedConsumableStream<HeadersEvent>;
|
|
95
|
-
listen(event: "listening"): DemuxedConsumableStream<ListeningEvent>;
|
|
96
|
-
listen(event: "ready"): DemuxedConsumableStream<{}>;
|
|
97
|
-
listen(event: 'socketAuthStateChange'): DemuxedConsumableStream<SocketAuthStateChangeEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
98
|
-
listen(event: 'socketAuthenticate'): DemuxedConsumableStream<SocketAuthenticateEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
99
|
-
listen(event: 'socketBadAuthToken'): DemuxedConsumableStream<SocketBadAuthTokenEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
100
|
-
listen(event: 'socketClose'): DemuxedConsumableStream<SocketCloseEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
101
|
-
listen(event: 'socketConnect'): DemuxedConsumableStream<SocketConnectEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
102
|
-
listen(event: 'socketConnectAbort'): DemuxedConsumableStream<SocketDisconnectEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
103
|
-
listen(event: 'socketConnecting'): DemuxedConsumableStream<SocketConnectingEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
104
|
-
listen(event: 'socketDeauthenticate'): DemuxedConsumableStream<SocketDeauthenticateEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
105
|
-
listen(event: 'socketDisconnect'): DemuxedConsumableStream<SocketDisconnectEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
106
|
-
listen(event: 'socketError'): DemuxedConsumableStream<SocketErrorEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
107
|
-
listen(event: 'socketMessage'): DemuxedConsumableStream<SocketMessageEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
108
|
-
listen(event: 'socketPing'): DemuxedConsumableStream<SocketPingEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
109
|
-
listen(event: 'socketPong'): DemuxedConsumableStream<SocketPongEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
110
|
-
listen(event: 'socketRemoveAuthToken'): DemuxedConsumableStream<SocketRemoveAuthTokenEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
111
|
-
listen(event: 'socketRequest'): DemuxedConsumableStream<SocketRequestEvent<TService, TIncoming, TPrivateIncoming>>;
|
|
112
|
-
listen(event: 'socketResponse'): DemuxedConsumableStream<SocketResponseEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
113
|
-
listen(event: 'socketSubscribe'): DemuxedConsumableStream<SocketSubscribeEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
114
|
-
listen(event: 'socketSubscribeFail'): DemuxedConsumableStream<SocketSubscribeFailEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
115
|
-
listen(event: 'socketSubscribeRequest'): DemuxedConsumableStream<SocketSubscribeEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
116
|
-
listen(event: 'socketSubscribeStateChange'): DemuxedConsumableStream<SocketSubscribeStateChangeEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
117
|
-
listen(event: 'socketUnsubscribe'): DemuxedConsumableStream<SocketUnsubscribeEvent<TChannel, TService, TIncoming, TOutgoing, TPrivateIncoming, TPrivateOutgoing, TServerState, TState>>;
|
|
118
|
-
listen(event: "warning"): DemuxedConsumableStream<WarningEvent>;
|
|
119
118
|
}
|