@cloudbase/realtime 2.0.2-alpha.0 → 2.5.0-beta.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/.eslintrc.js +46 -0
- package/dist/cjs/common.js +1 -1
- package/dist/cjs/error.js +8 -12
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/listener.js +2 -4
- package/dist/cjs/message.js +1 -1
- package/dist/cjs/snapshot.js +7 -7
- package/dist/cjs/utils.js +1 -1
- package/dist/cjs/virtual-websocket-client.d.ts +8 -8
- package/dist/cjs/virtual-websocket-client.js +281 -272
- package/dist/cjs/websocket-client.d.ts +21 -21
- package/dist/cjs/websocket-client.js +441 -444
- package/dist/cjs/ws-event.d.ts +2 -2
- package/dist/cjs/ws-event.js +47 -47
- package/dist/esm/common.js +1 -1
- package/dist/esm/error.js +8 -12
- package/dist/esm/index.js +3 -3
- package/dist/esm/listener.js +2 -4
- package/dist/esm/message.js +1 -1
- package/dist/esm/snapshot.js +7 -7
- package/dist/esm/utils.js +1 -1
- package/dist/esm/virtual-websocket-client.d.ts +8 -8
- package/dist/esm/virtual-websocket-client.js +282 -273
- package/dist/esm/websocket-client.d.ts +21 -21
- package/dist/esm/websocket-client.js +442 -445
- package/dist/esm/ws-event.d.ts +2 -2
- package/dist/esm/ws-event.js +46 -46
- package/package.json +9 -13
- package/src/common.ts +11 -11
- package/src/error.ts +13 -19
- package/src/index.ts +26 -26
- package/src/listener.ts +2 -4
- package/src/message.ts +2 -4
- package/src/snapshot.ts +6 -6
- package/src/utils.ts +1 -1
- package/src/virtual-websocket-client.ts +187 -387
- package/src/websocket-client.ts +385 -600
- package/src/ws-event.ts +24 -24
- package/.eslintrc +0 -30
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VirtualWebSocketClient } from './virtual-websocket-client';
|
|
2
2
|
import { IDatabaseServiceContext } from '@cloudbase/types/database';
|
|
3
3
|
import { IWatchOptions, DBRealtimeListener, IRequestMessage } from '@cloudbase/types/realtime';
|
|
4
|
-
import {
|
|
4
|
+
import { CloseEventCode } from './ws-event';
|
|
5
5
|
export interface IRealtimeWebSocketClientConstructorOptions {
|
|
6
6
|
maxReconnect?: number;
|
|
7
7
|
reconnectInterval?: number;
|
|
@@ -37,29 +37,29 @@ export interface IWSWatchOptions extends IWatchOptions {
|
|
|
37
37
|
orderBy?: Record<string, string>;
|
|
38
38
|
}
|
|
39
39
|
export declare class RealtimeWebSocketClient {
|
|
40
|
-
private
|
|
41
|
-
private
|
|
42
|
-
private
|
|
43
|
-
private
|
|
44
|
-
private
|
|
45
|
-
private
|
|
46
|
-
private
|
|
47
|
-
private
|
|
48
|
-
private
|
|
49
|
-
private
|
|
50
|
-
private
|
|
51
|
-
private
|
|
52
|
-
private
|
|
53
|
-
private
|
|
54
|
-
private
|
|
55
|
-
private
|
|
56
|
-
private
|
|
57
|
-
private
|
|
58
|
-
private
|
|
40
|
+
private virtualWSClient;
|
|
41
|
+
private queryIdClientMap;
|
|
42
|
+
private watchIdClientMap;
|
|
43
|
+
private maxReconnect;
|
|
44
|
+
private reconnectInterval;
|
|
45
|
+
private context;
|
|
46
|
+
private ws?;
|
|
47
|
+
private lastPingSendTS?;
|
|
48
|
+
private pingFailed;
|
|
49
|
+
private pongMissed;
|
|
50
|
+
private pingTimeoutId?;
|
|
51
|
+
private pongTimeoutId?;
|
|
52
|
+
private logins;
|
|
53
|
+
private wsInitPromise?;
|
|
54
|
+
private wsReadySubsribers;
|
|
55
|
+
private wsResponseWait;
|
|
56
|
+
private rttObserved;
|
|
57
|
+
private reconnectState;
|
|
58
|
+
private wsSign;
|
|
59
59
|
constructor(options: IRealtimeWebSocketClientConstructorOptions);
|
|
60
60
|
clearHeartbeat(): void;
|
|
61
61
|
send: <T = any>(opts: IWSSendOptions) => Promise<T>;
|
|
62
|
-
close(code:
|
|
62
|
+
close(code: CloseEventCode): void;
|
|
63
63
|
closeAllClients: (error: any) => void;
|
|
64
64
|
pauseClients: (clients?: Set<VirtualWebSocketClient>) => void;
|
|
65
65
|
resumeClients: (clients?: Set<VirtualWebSocketClient>) => void;
|