@socket-mesh/client 18.0.9 → 18.1.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/README.md +2 -2
- package/dist/client-auth-engine.d.ts +22 -0
- package/dist/client-auth-engine.js +52 -0
- package/dist/client-channels.d.ts +22 -0
- package/dist/client-channels.js +149 -0
- package/dist/client-socket-options.d.ts +24 -0
- package/dist/client-socket-options.js +6 -0
- package/dist/client-socket.d.ts +26 -0
- package/dist/client-socket.js +100 -0
- package/dist/client-transport.d.ts +52 -0
- package/dist/client-transport.js +261 -0
- package/dist/handlers/index.d.ts +4 -0
- package/dist/handlers/index.js +4 -0
- package/dist/handlers/kickout.d.ts +6 -0
- package/dist/handlers/kickout.js +5 -0
- package/dist/handlers/publish.d.ts +7 -0
- package/dist/handlers/publish.js +3 -0
- package/dist/handlers/remove-auth-token.d.ts +2 -0
- package/dist/handlers/remove-auth-token.js +3 -0
- package/dist/handlers/set-auth-token.d.ts +3 -0
- package/dist/handlers/set-auth-token.js +3 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/maps/client-map.d.ts +21 -0
- package/dist/maps/client-map.js +1 -0
- package/dist/maps/index.d.ts +3 -0
- package/dist/maps/index.js +3 -0
- package/dist/maps/server-map.d.ts +27 -0
- package/dist/maps/server-map.js +1 -0
- package/dist/maps/socket-map.d.ts +17 -0
- package/dist/maps/socket-map.js +1 -0
- package/dist/plugins/batching-plugin.d.ts +41 -0
- package/dist/plugins/batching-plugin.js +111 -0
- package/dist/plugins/in-order-plugin.d.ts +10 -0
- package/dist/plugins/in-order-plugin.js +70 -0
- package/dist/plugins/index.d.ts +3 -0
- package/dist/plugins/index.js +3 -0
- package/dist/plugins/offline-plugin.d.ts +13 -0
- package/dist/plugins/offline-plugin.js +47 -0
- package/package.json +54 -58
- package/auth.d.ts +0 -21
- package/auth.js +0 -49
- package/auth.js.map +0 -1
- package/client-options.d.ts +0 -53
- package/client-options.js +0 -2
- package/client-options.js.map +0 -1
- package/clientsocket.d.ts +0 -135
- package/clientsocket.js +0 -898
- package/clientsocket.js.map +0 -1
- package/events.d.ts +0 -54
- package/events.js +0 -2
- package/events.js.map +0 -1
- package/factory.d.ts +0 -3
- package/factory.js +0 -37
- package/factory.js.map +0 -1
- package/index.d.ts +0 -7
- package/index.js +0 -10
- package/index.js.map +0 -1
- package/remote-procedure.d.ts +0 -6
- package/remote-procedure.js +0 -10
- package/remote-procedure.js.map +0 -1
- package/socket-state.d.ts +0 -5
- package/socket-state.js +0 -7
- package/socket-state.js.map +0 -1
- package/transport-handlers.d.ts +0 -37
- package/transport-handlers.js +0 -2
- package/transport-handlers.js.map +0 -1
- package/transport.d.ts +0 -84
- package/transport.js +0 -441
- package/transport.js.map +0 -1
- package/wait.d.ts +0 -1
- package/wait.js +0 -8
- package/wait.js.map +0 -1
- package/ws-browser.d.ts +0 -15
- package/ws-browser.js +0 -40
- package/ws-browser.js.map +0 -1
package/transport.js
DELETED
|
@@ -1,441 +0,0 @@
|
|
|
1
|
-
import { Request } from "@socket-mesh/request";
|
|
2
|
-
import { BadConnectionError, hydrateError, socketProtocolErrorStatuses, TimeoutError } from '@socket-mesh/errors';
|
|
3
|
-
import * as ws from "ws";
|
|
4
|
-
import { SocketState } from "./socket-state.js";
|
|
5
|
-
let createWebSocket;
|
|
6
|
-
if (typeof WebSocket !== 'undefined') {
|
|
7
|
-
createWebSocket = function (uri, options) {
|
|
8
|
-
return new WebSocket(uri);
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
createWebSocket = function (uri, options) {
|
|
13
|
-
return new ws.WebSocket(uri, [], options);
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export class Transport {
|
|
17
|
-
constructor(authEngine, codecEngine, options, wsOptions, handlers) {
|
|
18
|
-
this.state = SocketState.CLOSED;
|
|
19
|
-
this.auth = authEngine;
|
|
20
|
-
this.codec = codecEngine;
|
|
21
|
-
this.options = options;
|
|
22
|
-
this.wsOptions = wsOptions;
|
|
23
|
-
this.protocolVersion = options.protocolVersion;
|
|
24
|
-
this.connectTimeout = options.connectTimeout;
|
|
25
|
-
this._pingTimeout = options.pingTimeout;
|
|
26
|
-
this.pingTimeoutDisabled = !!options.pingTimeoutDisabled;
|
|
27
|
-
this.callIdGenerator = options.callIdGenerator;
|
|
28
|
-
this.authTokenName = options.authTokenName;
|
|
29
|
-
this.isBufferingBatch = false;
|
|
30
|
-
this._pingTimeoutTicker = null;
|
|
31
|
-
this._callbackMap = {};
|
|
32
|
-
this._batchBuffer = [];
|
|
33
|
-
if (!handlers) {
|
|
34
|
-
handlers = {};
|
|
35
|
-
}
|
|
36
|
-
this._onOpenHandler = handlers.onOpen || function () { };
|
|
37
|
-
this._onOpenAbortHandler = handlers.onOpenAbort || function () { };
|
|
38
|
-
this._onCloseHandler = handlers.onClose || function () { };
|
|
39
|
-
this._onEventHandler = handlers.onEvent || function () { };
|
|
40
|
-
this._onErrorHandler = handlers.onError || function () { };
|
|
41
|
-
this._onInboundInvokeHandler = handlers.onInboundInvoke || function () { };
|
|
42
|
-
this._onInboundTransmitHandler = handlers.onInboundTransmit || function () { };
|
|
43
|
-
// Open the connection.
|
|
44
|
-
this.state = SocketState.CONNECTING;
|
|
45
|
-
let uri = this.uri();
|
|
46
|
-
let wsSocket = createWebSocket(uri, wsOptions);
|
|
47
|
-
wsSocket.binaryType = this.options.binaryType;
|
|
48
|
-
this.socket = wsSocket;
|
|
49
|
-
wsSocket.onopen = () => {
|
|
50
|
-
this._onOpen();
|
|
51
|
-
};
|
|
52
|
-
wsSocket.onclose = (event) => {
|
|
53
|
-
let code;
|
|
54
|
-
if (event.code == null) {
|
|
55
|
-
// This is to handle an edge case in React Native whereby
|
|
56
|
-
// event.code is undefined when the mobile device is locked.
|
|
57
|
-
// Note that this condition may also apply to an abnormal close
|
|
58
|
-
// (no close control frame) which would normally be a 1006.
|
|
59
|
-
code = 1005;
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
code = event.code;
|
|
63
|
-
}
|
|
64
|
-
this._destroy(code, event.reason);
|
|
65
|
-
};
|
|
66
|
-
wsSocket.onmessage = (message) => {
|
|
67
|
-
this._onMessage(message.data);
|
|
68
|
-
};
|
|
69
|
-
wsSocket.onerror = (error) => {
|
|
70
|
-
// The onclose event will be called automatically after the onerror event
|
|
71
|
-
// if the socket is connected - Otherwise, if it's in the middle of
|
|
72
|
-
// connecting, we want to close it manually with a 1006 - This is necessary
|
|
73
|
-
// to prevent inconsistent behavior when running the client in Node.js
|
|
74
|
-
// vs in a browser.
|
|
75
|
-
if (this.state === SocketState.CONNECTING) {
|
|
76
|
-
this._destroy(1006);
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
this._connectTimeoutRef = setTimeout(() => {
|
|
80
|
-
this._destroy(4007);
|
|
81
|
-
this.socket.close(4007);
|
|
82
|
-
}, this.connectTimeout);
|
|
83
|
-
if (this.protocolVersion === 1) {
|
|
84
|
-
this._handlePing = (message) => {
|
|
85
|
-
if (message === '#1') {
|
|
86
|
-
this._resetPingTimeout();
|
|
87
|
-
if (this.socket.readyState === this.socket.OPEN) {
|
|
88
|
-
this.send('#2');
|
|
89
|
-
}
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
return false;
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
this._handlePing = (message) => {
|
|
97
|
-
if (message === '') {
|
|
98
|
-
this._resetPingTimeout();
|
|
99
|
-
if (this.socket.readyState === this.socket.OPEN) {
|
|
100
|
-
this.send('');
|
|
101
|
-
}
|
|
102
|
-
return true;
|
|
103
|
-
}
|
|
104
|
-
return false;
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
get pingTimeout() {
|
|
109
|
-
return this._pingTimeout;
|
|
110
|
-
}
|
|
111
|
-
set pingTimeout(value) {
|
|
112
|
-
this._pingTimeout = value;
|
|
113
|
-
this._resetPingTimeout();
|
|
114
|
-
}
|
|
115
|
-
static computeUri(options) {
|
|
116
|
-
let scheme;
|
|
117
|
-
if (options.protocolScheme == null) {
|
|
118
|
-
scheme = options.secure ? 'wss' : 'ws';
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
scheme = options.protocolScheme;
|
|
122
|
-
}
|
|
123
|
-
let searchParams = new URLSearchParams(typeof options.query === 'string' ? options.query : '');
|
|
124
|
-
if (typeof options.query === 'object') {
|
|
125
|
-
for (let [key, value] of Object.entries(options.query || {})) {
|
|
126
|
-
if (Array.isArray(value)) {
|
|
127
|
-
for (let item of value) {
|
|
128
|
-
searchParams.append(key, item);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
searchParams.set(key, value);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
if (options.timestampRequests) {
|
|
137
|
-
searchParams.set(options.timestampParam, (new Date()).getTime().toString());
|
|
138
|
-
}
|
|
139
|
-
let qs = searchParams.toString();
|
|
140
|
-
if (qs.length) {
|
|
141
|
-
qs = '?' + qs;
|
|
142
|
-
}
|
|
143
|
-
let host;
|
|
144
|
-
let path;
|
|
145
|
-
if (options.socketPath == null) {
|
|
146
|
-
if (options.host) {
|
|
147
|
-
host = options.host;
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
let port = '';
|
|
151
|
-
if (options.port && ((scheme === 'wss' && options.port !== 443)
|
|
152
|
-
|| (scheme === 'ws' && options.port !== 80))) {
|
|
153
|
-
port = ':' + options.port;
|
|
154
|
-
}
|
|
155
|
-
host = options.hostname + port;
|
|
156
|
-
}
|
|
157
|
-
path = options.path;
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
host = options.socketPath;
|
|
161
|
-
path = `:${options.path}`;
|
|
162
|
-
}
|
|
163
|
-
return scheme + '://' + host + path + qs;
|
|
164
|
-
}
|
|
165
|
-
uri() {
|
|
166
|
-
return Transport.computeUri(this.options);
|
|
167
|
-
}
|
|
168
|
-
;
|
|
169
|
-
async _onOpen() {
|
|
170
|
-
clearTimeout(this._connectTimeoutRef);
|
|
171
|
-
this._resetPingTimeout();
|
|
172
|
-
let status;
|
|
173
|
-
try {
|
|
174
|
-
status = await this._handshake();
|
|
175
|
-
}
|
|
176
|
-
catch (err) {
|
|
177
|
-
if (err.statusCode == null) {
|
|
178
|
-
err.statusCode = 4003;
|
|
179
|
-
}
|
|
180
|
-
this._onError(err);
|
|
181
|
-
this._destroy(err.statusCode, err.toString());
|
|
182
|
-
this.socket.close(err.statusCode);
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
this.state = SocketState.OPEN;
|
|
186
|
-
if (status) {
|
|
187
|
-
this._pingTimeout = status.pingTimeout;
|
|
188
|
-
}
|
|
189
|
-
this._resetPingTimeout();
|
|
190
|
-
this._onOpenHandler(status);
|
|
191
|
-
}
|
|
192
|
-
async _handshake() {
|
|
193
|
-
let token = await this.auth.loadToken(this.authTokenName);
|
|
194
|
-
// Don't wait for this.state to be 'open'.
|
|
195
|
-
// The underlying WebSocket (this.socket) is already open.
|
|
196
|
-
let options = {
|
|
197
|
-
force: true
|
|
198
|
-
};
|
|
199
|
-
let status = await this.invoke('#handshake', { authToken: token }, options);
|
|
200
|
-
if (status) {
|
|
201
|
-
// Add the token which was used as part of authentication attempt
|
|
202
|
-
// to the status object.
|
|
203
|
-
status.authToken = token;
|
|
204
|
-
if (status.authError) {
|
|
205
|
-
status.authError = hydrateError(status.authError);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
return status;
|
|
209
|
-
}
|
|
210
|
-
_abortAllPendingEventsDueToBadConnection(failureType) {
|
|
211
|
-
Object.keys(this._callbackMap || {}).forEach((i) => {
|
|
212
|
-
let eventObject = this._callbackMap[i];
|
|
213
|
-
delete this._callbackMap[i];
|
|
214
|
-
clearTimeout(eventObject.timeout);
|
|
215
|
-
delete eventObject.timeout;
|
|
216
|
-
let errorMessage = `Event ${eventObject.event} was aborted due to a bad connection`;
|
|
217
|
-
let badConnectionError = new BadConnectionError(errorMessage, failureType);
|
|
218
|
-
let callback = eventObject.callback;
|
|
219
|
-
if (callback) {
|
|
220
|
-
delete eventObject.callback;
|
|
221
|
-
callback.call(eventObject, badConnectionError, eventObject);
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
_destroy(code, reason) {
|
|
226
|
-
if (!reason && socketProtocolErrorStatuses[code]) {
|
|
227
|
-
reason = socketProtocolErrorStatuses[code];
|
|
228
|
-
}
|
|
229
|
-
delete this.socket.onopen;
|
|
230
|
-
delete this.socket.onclose;
|
|
231
|
-
delete this.socket.onmessage;
|
|
232
|
-
delete this.socket.onerror;
|
|
233
|
-
clearTimeout(this._connectTimeoutRef);
|
|
234
|
-
clearTimeout(this._pingTimeoutTicker);
|
|
235
|
-
if (this.state === SocketState.OPEN) {
|
|
236
|
-
this.state = SocketState.CLOSED;
|
|
237
|
-
this._abortAllPendingEventsDueToBadConnection('disconnect');
|
|
238
|
-
this._onCloseHandler({ code, reason });
|
|
239
|
-
}
|
|
240
|
-
else if (this.state === SocketState.CONNECTING) {
|
|
241
|
-
this.state = SocketState.CLOSED;
|
|
242
|
-
this._abortAllPendingEventsDueToBadConnection('connectAbort');
|
|
243
|
-
this._onOpenAbortHandler({ code, reason });
|
|
244
|
-
}
|
|
245
|
-
else if (this.state === SocketState.CLOSED) {
|
|
246
|
-
this._abortAllPendingEventsDueToBadConnection('connectAbort');
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
_processInboundPacket(packet, message) {
|
|
250
|
-
if (packet && typeof packet.event === 'string') {
|
|
251
|
-
if (typeof packet.cid === 'number') {
|
|
252
|
-
const request = new Request(this, packet.cid, packet.event, packet.data);
|
|
253
|
-
this._onInboundInvokeHandler(request);
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
this._onInboundTransmitHandler({ ...packet });
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
else if (packet && typeof packet.rid === 'number') {
|
|
260
|
-
const eventObject = this._callbackMap[packet.rid];
|
|
261
|
-
if (eventObject) {
|
|
262
|
-
clearTimeout(eventObject.timeout);
|
|
263
|
-
delete eventObject.timeout;
|
|
264
|
-
delete this._callbackMap[packet.rid];
|
|
265
|
-
if (eventObject.callback) {
|
|
266
|
-
const rehydratedError = hydrateError(packet.error);
|
|
267
|
-
eventObject.callback(rehydratedError, packet.data);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
this._onEventHandler({ event: 'raw', data: { message } });
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
_onMessage(message) {
|
|
276
|
-
this._onEventHandler({ event: 'message', data: { message } });
|
|
277
|
-
if (this._handlePing(message)) {
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
let packet = this.decode(message);
|
|
281
|
-
if (Array.isArray(packet)) {
|
|
282
|
-
let len = packet.length;
|
|
283
|
-
for (let i = 0; i < len; i++) {
|
|
284
|
-
this._processInboundPacket(packet[i], message);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
else {
|
|
288
|
-
this._processInboundPacket(packet, message);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
_onError(error) {
|
|
292
|
-
this._onErrorHandler({ error });
|
|
293
|
-
}
|
|
294
|
-
_resetPingTimeout() {
|
|
295
|
-
if (this.pingTimeoutDisabled) {
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
clearTimeout(this._pingTimeoutTicker);
|
|
299
|
-
this._pingTimeoutTicker = setTimeout(() => {
|
|
300
|
-
this._destroy(4000);
|
|
301
|
-
this.socket.close(4000);
|
|
302
|
-
}, this._pingTimeout);
|
|
303
|
-
}
|
|
304
|
-
clearAllListeners() {
|
|
305
|
-
this._onOpenHandler = () => { };
|
|
306
|
-
this._onOpenAbortHandler = () => { };
|
|
307
|
-
this._onCloseHandler = () => { };
|
|
308
|
-
this._onEventHandler = () => { };
|
|
309
|
-
this._onErrorHandler = () => { };
|
|
310
|
-
this._onInboundInvokeHandler = () => { };
|
|
311
|
-
this._onInboundTransmitHandler = () => { };
|
|
312
|
-
}
|
|
313
|
-
startBatch() {
|
|
314
|
-
this.isBufferingBatch = true;
|
|
315
|
-
this._batchBuffer = [];
|
|
316
|
-
}
|
|
317
|
-
flushBatch() {
|
|
318
|
-
this.isBufferingBatch = false;
|
|
319
|
-
if (!this._batchBuffer.length) {
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
let serializedBatch = this.serializeObject(this._batchBuffer);
|
|
323
|
-
this._batchBuffer = [];
|
|
324
|
-
this.send(serializedBatch);
|
|
325
|
-
}
|
|
326
|
-
cancelBatch() {
|
|
327
|
-
this.isBufferingBatch = false;
|
|
328
|
-
this._batchBuffer = [];
|
|
329
|
-
}
|
|
330
|
-
getBytesReceived() {
|
|
331
|
-
return ('bytesReceived' in this.socket) ? this.socket.bytesReceived : undefined;
|
|
332
|
-
}
|
|
333
|
-
close(code, reason) {
|
|
334
|
-
if (this.state === SocketState.OPEN || this.state === SocketState.CONNECTING) {
|
|
335
|
-
code = code || 1000;
|
|
336
|
-
this._destroy(code, reason);
|
|
337
|
-
this.socket.close(code, reason);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
transmitObject(eventObject) {
|
|
341
|
-
let simpleEventObject = {
|
|
342
|
-
event: eventObject.event,
|
|
343
|
-
data: eventObject.data
|
|
344
|
-
};
|
|
345
|
-
if (eventObject.callback) {
|
|
346
|
-
simpleEventObject.cid = eventObject.cid = this.callIdGenerator();
|
|
347
|
-
this._callbackMap[eventObject.cid] = eventObject;
|
|
348
|
-
}
|
|
349
|
-
this.sendObject(simpleEventObject);
|
|
350
|
-
return eventObject.cid || null;
|
|
351
|
-
}
|
|
352
|
-
_handleEventAckTimeout(eventObject) {
|
|
353
|
-
if (eventObject.cid) {
|
|
354
|
-
delete this._callbackMap[eventObject.cid];
|
|
355
|
-
}
|
|
356
|
-
delete eventObject.timeout;
|
|
357
|
-
let callback = eventObject.callback;
|
|
358
|
-
if (callback) {
|
|
359
|
-
delete eventObject.callback;
|
|
360
|
-
let error = new TimeoutError(`Event response for ${eventObject.event} event timed out`);
|
|
361
|
-
callback.call(eventObject, error, eventObject);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
transmit(event, data, options) {
|
|
365
|
-
let eventObject = {
|
|
366
|
-
event,
|
|
367
|
-
data
|
|
368
|
-
};
|
|
369
|
-
if (this.state === SocketState.OPEN || options.force) {
|
|
370
|
-
this.transmitObject(eventObject);
|
|
371
|
-
}
|
|
372
|
-
return Promise.resolve();
|
|
373
|
-
}
|
|
374
|
-
invokeRaw(event, data, options, callback) {
|
|
375
|
-
let eventObject = {
|
|
376
|
-
event,
|
|
377
|
-
data,
|
|
378
|
-
callback
|
|
379
|
-
};
|
|
380
|
-
if (!options.noTimeout) {
|
|
381
|
-
eventObject.timeout = setTimeout(() => {
|
|
382
|
-
this._handleEventAckTimeout(eventObject);
|
|
383
|
-
}, this.options.ackTimeout);
|
|
384
|
-
}
|
|
385
|
-
let cid = null;
|
|
386
|
-
if (this.state === SocketState.OPEN || options.force) {
|
|
387
|
-
cid = this.transmitObject(eventObject);
|
|
388
|
-
}
|
|
389
|
-
return cid;
|
|
390
|
-
}
|
|
391
|
-
invoke(event, data, options) {
|
|
392
|
-
return new Promise((resolve, reject) => {
|
|
393
|
-
this.invokeRaw(event, data, options, (err, data) => {
|
|
394
|
-
if (err) {
|
|
395
|
-
reject(err);
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
resolve(data);
|
|
399
|
-
});
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
cancelPendingResponse(cid) {
|
|
403
|
-
delete this._callbackMap[cid];
|
|
404
|
-
}
|
|
405
|
-
decode(message) {
|
|
406
|
-
return this.codec.decode(message);
|
|
407
|
-
}
|
|
408
|
-
encode(object) {
|
|
409
|
-
return this.codec.encode(object);
|
|
410
|
-
}
|
|
411
|
-
send(data) {
|
|
412
|
-
if (this.socket.readyState !== this.socket.OPEN) {
|
|
413
|
-
this._destroy(1005);
|
|
414
|
-
}
|
|
415
|
-
else {
|
|
416
|
-
this.socket.send(data);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
serializeObject(object) {
|
|
420
|
-
let str;
|
|
421
|
-
try {
|
|
422
|
-
str = this.encode(object);
|
|
423
|
-
}
|
|
424
|
-
catch (error) {
|
|
425
|
-
this._onError(error);
|
|
426
|
-
return null;
|
|
427
|
-
}
|
|
428
|
-
return str;
|
|
429
|
-
}
|
|
430
|
-
sendObject(object) {
|
|
431
|
-
if (this.isBufferingBatch) {
|
|
432
|
-
this._batchBuffer.push(object);
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
let str = this.serializeObject(object);
|
|
436
|
-
if (str != null) {
|
|
437
|
-
this.send(str);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
//# sourceMappingURL=transport.js.map
|
package/transport.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,2BAA2B,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAKlH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,IAAI,eAAgF,CAAC;AAErF,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;IACtC,eAAe,GAAG,UAAU,GAAG,EAAE,OAAO;QACvC,OAAO,IAAI,SAAS,CAAC,GAAG,CAAQ,CAAC;IAClC,CAAC,CAAC;AACH,CAAC;KAAM,CAAC;IACP,eAAe,GAAG,UAAU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CAAC,MAAM,CAAC,UAAU,KAAK,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;IACF,CAAC;IAED,eAAe,CAAC,MAAW;QAC1B,IAAI,GAAG,CAAC;QAER,IAAI,CAAC;YACJ,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC3B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,GAAG,CAAC;IACZ,CAAC;IAED,UAAU,CAAC,MAAW;QACrB,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC3B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC/B,OAAO;QACR,CAAC;QAED,IAAI,GAAG,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAEvC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YACjB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC;IACF,CAAC;CACD"}
|
package/wait.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function wait(duration: number): Promise<void>;
|
package/wait.js
DELETED
package/wait.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wait.js","sourceRoot":"","sources":["../src/wait.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,IAAI,CAAC,QAAgB;IACnC,OAAO,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;QACjC,UAAU,CAAC,GAAG,EAAE;YACd,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,QAAQ,CAAC,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/ws-browser.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WebSocket constructor.
|
|
3
|
-
*
|
|
4
|
-
* The third `opts` options object gets ignored in web browsers, since it's
|
|
5
|
-
* non-standard, and throws a TypeError if passed to the constructor.
|
|
6
|
-
* See: https://github.com/einaros/ws/issues/227
|
|
7
|
-
*
|
|
8
|
-
* @param {String} uri
|
|
9
|
-
* @param {Array} protocols (optional)
|
|
10
|
-
* @api public
|
|
11
|
-
*/
|
|
12
|
-
declare function ws(uri: string | URL, protocols?: string | string[]): WebSocket;
|
|
13
|
-
declare namespace ws {
|
|
14
|
-
var prototype: WebSocket;
|
|
15
|
-
}
|
package/ws-browser.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
//let global;
|
|
2
|
-
if (typeof global !== 'undefined') {
|
|
3
|
-
// global spec defines a reference to the global object called 'global'
|
|
4
|
-
// https://github.com/tc39/proposal-global
|
|
5
|
-
// `global` is also defined in NodeJS
|
|
6
|
-
}
|
|
7
|
-
else if (typeof window !== 'undefined') {
|
|
8
|
-
// window is defined in browsers
|
|
9
|
-
global = window;
|
|
10
|
-
}
|
|
11
|
-
else if (typeof self !== 'undefined') {
|
|
12
|
-
// self is defined in WebWorkers
|
|
13
|
-
global = self;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* WebSocket constructor.
|
|
17
|
-
*
|
|
18
|
-
* The third `opts` options object gets ignored in web browsers, since it's
|
|
19
|
-
* non-standard, and throws a TypeError if passed to the constructor.
|
|
20
|
-
* See: https://github.com/einaros/ws/issues/227
|
|
21
|
-
*
|
|
22
|
-
* @param {String} uri
|
|
23
|
-
* @param {Array} protocols (optional)
|
|
24
|
-
* @api public
|
|
25
|
-
*/
|
|
26
|
-
function ws(uri, protocols) {
|
|
27
|
-
let instance;
|
|
28
|
-
if (protocols) {
|
|
29
|
-
instance = new WebSocket(uri, protocols);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
instance = new WebSocket(uri);
|
|
33
|
-
}
|
|
34
|
-
return instance;
|
|
35
|
-
}
|
|
36
|
-
if (WebSocket) {
|
|
37
|
-
ws.prototype = WebSocket.prototype;
|
|
38
|
-
}
|
|
39
|
-
module.exports = WebSocket ? ws : null;
|
|
40
|
-
//# sourceMappingURL=ws-browser.js.map
|
package/ws-browser.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ws-browser.js","sourceRoot":"","sources":["../src/ws-browser.ts"],"names":[],"mappings":"AAAA,aAAa;AAEb,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IACnC,uEAAuE;IACvE,0CAA0C;IAC1C,qCAAqC;AACtC,CAAC;KACI,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IACxC,gCAAgC;IAChC,MAAM,GAAG,MAAM,CAAC;AACjB,CAAC;KACI,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE,CAAC;IACtC,gCAAgC;IAChC,MAAM,GAAG,IAAI,CAAC;AACf,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,EAAE,CAAC,GAAiB,EAAE,SAA6B;IAC1D,IAAI,QAAQ,CAAC;IACb,IAAI,SAAS,EAAE,CAAC;QACd,QAAQ,GAAG,IAAI,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC3C,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,IAAI,SAAS,EAAE,CAAC;IACf,EAAE,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC;AACpC,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC"}
|