centrifuge 4.0.1 → 5.0.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.
Files changed (61) hide show
  1. package/README.md +5 -1
  2. package/build/centrifuge.d.ts +158 -169
  3. package/build/cjs/centrifuge.d.ts +158 -0
  4. package/build/cjs/codes.d.ts +36 -0
  5. package/build/cjs/protobuf.d.ts +8 -0
  6. package/build/cjs/protobuf.js +11753 -0
  7. package/build/cjs/subscription.d.ts +83 -0
  8. package/build/cjs/types.d.ts +287 -0
  9. package/build/codes.d.ts +36 -36
  10. package/build/esm/centrifuge.d.ts +158 -0
  11. package/build/esm/codes.d.ts +36 -0
  12. package/build/esm/index.d.ts +5 -0
  13. package/build/{json.d.ts → esm/json.d.ts} +1 -1
  14. package/build/esm/protobuf.codec.d.ts +1 -0
  15. package/build/esm/protobuf.d.ts +8 -0
  16. package/build/esm/protobuf.js +11749 -0
  17. package/build/esm/subscription.d.ts +83 -0
  18. package/build/{transport_http_stream.d.ts → esm/transport_http_stream.d.ts} +1 -1
  19. package/build/{transport_sockjs.d.ts → esm/transport_sockjs.d.ts} +1 -1
  20. package/build/{transport_sse.d.ts → esm/transport_sse.d.ts} +1 -1
  21. package/build/{transport_websocket.d.ts → esm/transport_websocket.d.ts} +1 -1
  22. package/build/{transport_webtransport.d.ts → esm/transport_webtransport.d.ts} +1 -1
  23. package/build/esm/types.d.ts +287 -0
  24. package/build/{utils.d.ts → esm/utils.d.ts} +1 -1
  25. package/build/index.d.ts +5 -4
  26. package/build/index.js +3422 -23
  27. package/build/index.mjs +3418 -0
  28. package/build/subscription.d.ts +83 -83
  29. package/build/types.d.ts +287 -290
  30. package/dist/centrifuge.js +6 -6
  31. package/dist/centrifuge.js.map +4 -4
  32. package/dist/centrifuge.protobuf.js +7 -7
  33. package/dist/centrifuge.protobuf.js.map +4 -4
  34. package/package.json +12 -5
  35. package/build/centrifuge.js +0 -1680
  36. package/build/centrifuge.js.map +0 -1
  37. package/build/codes.js +0 -40
  38. package/build/codes.js.map +0 -1
  39. package/build/index.js.map +0 -1
  40. package/build/json.js +0 -18
  41. package/build/json.js.map +0 -1
  42. package/build/protobuf/client.proto.json +0 -836
  43. package/build/protobuf/index.d.ts +0 -18
  44. package/build/protobuf/index.js +0 -64
  45. package/build/protobuf/index.js.map +0 -1
  46. package/build/subscription.js +0 -620
  47. package/build/subscription.js.map +0 -1
  48. package/build/transport_http_stream.js +0 -201
  49. package/build/transport_http_stream.js.map +0 -1
  50. package/build/transport_sockjs.js +0 -46
  51. package/build/transport_sockjs.js.map +0 -1
  52. package/build/transport_sse.js +0 -89
  53. package/build/transport_sse.js.map +0 -1
  54. package/build/transport_websocket.js +0 -58
  55. package/build/transport_websocket.js.map +0 -1
  56. package/build/transport_webtransport.js +0 -177
  57. package/build/transport_webtransport.js.map +0 -1
  58. package/build/types.js +0 -18
  59. package/build/types.js.map +0 -1
  60. package/build/utils.js +0 -52
  61. package/build/utils.js.map +0 -1
package/README.md CHANGED
@@ -305,6 +305,10 @@ centrifuge.presenceStats("channel").then(function(resp) {
305
305
 
306
306
  Returns a Promise which will be resolved upon connection establishement (i.e. when Client goes to `connected` state).
307
307
 
308
+ #### setToken method
309
+
310
+ `setToken` may be useful to dynamically change the connection token. For example when you need to implement login/logout workflow. See an example in [blog post](https://centrifugal.dev/blog/2023/06/29/centrifugo-v5-released#token-behaviour-adjustments-in-sdks).
311
+
308
312
  #### error event
309
313
 
310
314
  To listen asynchronous error happening internally while Centrifuge client works you can set an `error` handler:
@@ -333,7 +337,7 @@ In case of Centrifugo on a server side this may be a JSON Web Token - see [authe
333
337
 
334
338
  **Connection token must come to the frontend from application backend - i.e. must be generated on the backend side**. The way to deliver token to the application frontend is up to the developer. Usually you can pass it in template rendering context or issue a separate call to request a connection token from the backend.
335
339
 
336
- If the token sets connection expiration then the client SDK will keep the token refreshed. It does this by calling a special callback function. This callback must return a new token. If a new token with updated connection expiration is returned from callback then it's sent to Centrifugo. If your callback returns an empty string this means the user has no permission to connect to Centrifugo and the Client will move to a disconnected state. In case of error returned by your callback SDK will retry the operation after some jittered time.
340
+ If the token sets connection expiration then the client SDK will keep the token refreshed. It does this by calling a special callback function. This callback must return a new token. If a new token with updated connection expiration is returned from callback then it's sent to Centrifugo. In case of error returned by your callback SDK will retry the operation after some jittered time. You can throw a special error (`throw new Centrifuge.UnauthorizedError();`) from `getToken` function to move the client into disconnected state (for example, when there is no permission to connect anymore).
337
341
 
338
342
  An example of possible `getToken` function implementation:
339
343
 
@@ -1,169 +1,158 @@
1
- import { Subscription } from './subscription';
2
- import { State, Options, ClientEvents, TypedEventEmitter, RpcResult, SubscriptionOptions, HistoryOptions, HistoryResult, PublishResult, PresenceResult, PresenceStatsResult, TransportEndpoint } from './types';
3
- export declare class UnauthorizedError extends Error {
4
- constructor(message: any);
5
- }
6
- declare const Centrifuge_base: new () => TypedEventEmitter<ClientEvents>;
7
- /** Centrifuge is a Centrifuge/Centrifugo bidirectional client. */
8
- export declare class Centrifuge extends Centrifuge_base {
9
- state: State;
10
- private _endpoint;
11
- private _emulation;
12
- private _transports;
13
- private _currentTransportIndex;
14
- private _triedAllTransports;
15
- private _transportWasOpen;
16
- private _transport?;
17
- private _transportId;
18
- private _deviceWentOffline;
19
- private _transportClosed;
20
- private _reconnecting;
21
- private _reconnectTimeout?;
22
- private _reconnectAttempts;
23
- private _client;
24
- private _session;
25
- private _node;
26
- private _subs;
27
- private _serverSubs;
28
- private _commandId;
29
- private _commands;
30
- private _batching;
31
- private _refreshRequired;
32
- private _refreshTimeout?;
33
- private _callbacks;
34
- private _token;
35
- private _data;
36
- private _dispatchPromise;
37
- private _serverPing;
38
- private _serverPingTimeout?;
39
- private _sendPong;
40
- private _promises;
41
- private _promiseId;
42
- private _networkEventsSet;
43
- private _debugEnabled;
44
- private _config;
45
- protected _encoder: any;
46
- protected _decoder: any;
47
- static State: {
48
- Disconnected: string;
49
- Connecting: string;
50
- Connected: string;
51
- };
52
- static SubscriptionState: {
53
- Unsubscribed: string;
54
- Subscribing: string;
55
- Subscribed: string;
56
- };
57
- static UnauthorizedError: any;
58
- /** Constructs Centrifuge client. Call connect() method to start connecting. */
59
- constructor(endpoint: string | Array<TransportEndpoint>, options?: Partial<Options>);
60
- /** newSubscription allocates new Subscription to a channel. Since server only allows
61
- * one subscription per channel per client this method throws if client already has
62
- * channel subscription in internal registry.
63
- * */
64
- newSubscription(channel: string, options?: Partial<SubscriptionOptions>): Subscription;
65
- /** getSubscription returns Subscription if it's registered in the internal
66
- * registry or null. */
67
- getSubscription(channel: string): Subscription | null;
68
- /** removeSubscription allows removing Subcription from the internal registry. Subscrption
69
- * must be in unsubscribed state. */
70
- removeSubscription(sub: Subscription | null): void;
71
- /** Get a map with all current client-side subscriptions. */
72
- subscriptions(): Record<string, Subscription>;
73
- /** ready returns a Promise which resolves upon client goes to Connected
74
- * state and rejects in case of client goes to Disconnected or Failed state.
75
- * Users can provide optional timeout in milliseconds. */
76
- ready(timeout?: number): Promise<void>;
77
- /** connect to a server. */
78
- connect(): void;
79
- /** disconnect from a server. */
80
- disconnect(): void;
81
- setToken(token: string): void;
82
- /** send asynchronous data to a server (without any response from a server
83
- * expected, see rpc method if you need response). */
84
- send(data: any): Promise<void>;
85
- /** rpc to a server - i.e. a call which waits for a response with data. */
86
- rpc(method: string, data: any): Promise<RpcResult>;
87
- /** publish data to a channel. */
88
- publish(channel: string, data: any): Promise<PublishResult>;
89
- /** history for a channel. By default it does not return publications (only current
90
- * StreamPosition data) – provide an explicit limit > 0 to load publications.*/
91
- history(channel: string, options?: HistoryOptions): Promise<HistoryResult>;
92
- /** presence for a channel. */
93
- presence(channel: string): Promise<PresenceResult>;
94
- /** presence stats for a channel. */
95
- presenceStats(channel: string): Promise<PresenceStatsResult>;
96
- /** start command batching (collect into temporary buffer without sending to a server)
97
- * until stopBatching called.*/
98
- startBatching(): void;
99
- /** stop batching commands and flush collected commands to the
100
- * network (all in one request/frame).*/
101
- stopBatching(): void;
102
- private _debug;
103
- private _configure;
104
- private _setState;
105
- private _isDisconnected;
106
- private _isConnecting;
107
- private _isConnected;
108
- private _nextCommandId;
109
- private _setNetworkEvents;
110
- private _getReconnectDelay;
111
- private _clearOutgoingRequests;
112
- private _clearConnectedState;
113
- private _handleWriteError;
114
- private _transportSendCommands;
115
- private _initializeTransport;
116
- private _sendConnect;
117
- private _startReconnecting;
118
- private _connectError;
119
- private _scheduleReconnect;
120
- private _constructConnectCommand;
121
- private _getHistoryRequest;
122
- private _methodCall;
123
- private _callPromise;
124
- private _dataReceived;
125
- private _dispatchSynchronized;
126
- private _dispatchReply;
127
- private _call;
128
- private _startConnecting;
129
- private _disconnect;
130
- private _failUnauthorized;
131
- private _getToken;
132
- private _refresh;
133
- private _refreshError;
134
- private _getRefreshRetryDelay;
135
- private _refreshResponse;
136
- private _removeSubscription;
137
- protected _unsubscribe(sub: Subscription): void;
138
- private _getSub;
139
- private _isServerSub;
140
- private _sendSubscribeCommands;
141
- private _connectResponse;
142
- private _processServerSubs;
143
- private _clearRefreshTimeout;
144
- private _clearReconnectTimeout;
145
- private _clearServerPingTimeout;
146
- private _waitServerPing;
147
- private _getSubscribeContext;
148
- private _handleReply;
149
- private _handleJoin;
150
- private _handleLeave;
151
- private _handleUnsubscribe;
152
- private _handleSubscribe;
153
- private _handleDisconnect;
154
- private _getPublicationContext;
155
- private _getJoinLeaveContext;
156
- private _handlePublication;
157
- private _handleMessage;
158
- private _handleServerPing;
159
- private _handlePush;
160
- private _flush;
161
- private _createErrorObject;
162
- private _registerCall;
163
- private _addCommand;
164
- private _nextPromiseId;
165
- private _nextTransportId;
166
- private _resolvePromises;
167
- private _rejectPromises;
168
- }
169
- export {};
1
+ import { Subscription } from './subscription';
2
+ import { State, Options, ClientEvents, TypedEventEmitter, RpcResult, SubscriptionOptions, HistoryOptions, HistoryResult, PublishResult, PresenceResult, PresenceStatsResult, TransportEndpoint } from './types';
3
+ export declare class UnauthorizedError extends Error {
4
+ constructor(message: any);
5
+ }
6
+ declare const Centrifuge_base: new () => TypedEventEmitter<ClientEvents>;
7
+ /** Centrifuge is a Centrifuge/Centrifugo bidirectional client. */
8
+ export declare class Centrifuge extends Centrifuge_base {
9
+ state: State;
10
+ private _endpoint;
11
+ private _emulation;
12
+ private _transports;
13
+ private _currentTransportIndex;
14
+ private _triedAllTransports;
15
+ private _transportWasOpen;
16
+ private _transport?;
17
+ private _transportId;
18
+ private _deviceWentOffline;
19
+ private _transportClosed;
20
+ private _reconnecting;
21
+ private _reconnectTimeout?;
22
+ private _reconnectAttempts;
23
+ private _client;
24
+ private _session;
25
+ private _node;
26
+ private _subs;
27
+ private _serverSubs;
28
+ private _commandId;
29
+ private _commands;
30
+ private _batching;
31
+ private _refreshRequired;
32
+ private _refreshTimeout?;
33
+ private _callbacks;
34
+ private _token;
35
+ private _data;
36
+ private _dispatchPromise;
37
+ private _serverPing;
38
+ private _serverPingTimeout?;
39
+ private _sendPong;
40
+ private _promises;
41
+ private _promiseId;
42
+ private _networkEventsSet;
43
+ private _debugEnabled;
44
+ private _config;
45
+ protected _codec: any;
46
+ /** Constructs Centrifuge client. Call connect() method to start connecting. */
47
+ constructor(endpoint: string | Array<TransportEndpoint>, options?: Partial<Options>);
48
+ /** newSubscription allocates new Subscription to a channel. Since server only allows
49
+ * one subscription per channel per client this method throws if client already has
50
+ * channel subscription in internal registry.
51
+ * */
52
+ newSubscription(channel: string, options?: Partial<SubscriptionOptions>): Subscription;
53
+ /** getSubscription returns Subscription if it's registered in the internal
54
+ * registry or null. */
55
+ getSubscription(channel: string): Subscription | null;
56
+ /** removeSubscription allows removing Subcription from the internal registry. Subscrption
57
+ * must be in unsubscribed state. */
58
+ removeSubscription(sub: Subscription | null): void;
59
+ /** Get a map with all current client-side subscriptions. */
60
+ subscriptions(): Record<string, Subscription>;
61
+ /** ready returns a Promise which resolves upon client goes to Connected
62
+ * state and rejects in case of client goes to Disconnected or Failed state.
63
+ * Users can provide optional timeout in milliseconds. */
64
+ ready(timeout?: number): Promise<void>;
65
+ /** connect to a server. */
66
+ connect(): void;
67
+ /** disconnect from a server. */
68
+ disconnect(): void;
69
+ /** setToken allows setting connection token. Or resetting used token to be empty. */
70
+ setToken(token: string): void;
71
+ /** send asynchronous data to a server (without any response from a server
72
+ * expected, see rpc method if you need response). */
73
+ send(data: any): Promise<void>;
74
+ /** rpc to a server - i.e. a call which waits for a response with data. */
75
+ rpc(method: string, data: any): Promise<RpcResult>;
76
+ /** publish data to a channel. */
77
+ publish(channel: string, data: any): Promise<PublishResult>;
78
+ /** history for a channel. By default it does not return publications (only current
79
+ * StreamPosition data) provide an explicit limit > 0 to load publications.*/
80
+ history(channel: string, options?: HistoryOptions): Promise<HistoryResult>;
81
+ /** presence for a channel. */
82
+ presence(channel: string): Promise<PresenceResult>;
83
+ /** presence stats for a channel. */
84
+ presenceStats(channel: string): Promise<PresenceStatsResult>;
85
+ /** start command batching (collect into temporary buffer without sending to a server)
86
+ * until stopBatching called.*/
87
+ startBatching(): void;
88
+ /** stop batching commands and flush collected commands to the
89
+ * network (all in one request/frame).*/
90
+ stopBatching(): void;
91
+ private _debug;
92
+ private _configure;
93
+ private _setState;
94
+ private _isDisconnected;
95
+ private _isConnecting;
96
+ private _isConnected;
97
+ private _nextCommandId;
98
+ private _setNetworkEvents;
99
+ private _getReconnectDelay;
100
+ private _clearOutgoingRequests;
101
+ private _clearConnectedState;
102
+ private _handleWriteError;
103
+ private _transportSendCommands;
104
+ private _initializeTransport;
105
+ private _sendConnect;
106
+ private _startReconnecting;
107
+ private _connectError;
108
+ private _scheduleReconnect;
109
+ private _constructConnectCommand;
110
+ private _getHistoryRequest;
111
+ private _methodCall;
112
+ private _callPromise;
113
+ private _dataReceived;
114
+ private _dispatchSynchronized;
115
+ private _dispatchReply;
116
+ private _call;
117
+ private _startConnecting;
118
+ private _disconnect;
119
+ private _failUnauthorized;
120
+ private _getToken;
121
+ private _refresh;
122
+ private _refreshError;
123
+ private _getRefreshRetryDelay;
124
+ private _refreshResponse;
125
+ private _removeSubscription;
126
+ protected _unsubscribe(sub: Subscription): void;
127
+ private _getSub;
128
+ private _isServerSub;
129
+ private _sendSubscribeCommands;
130
+ private _connectResponse;
131
+ private _processServerSubs;
132
+ private _clearRefreshTimeout;
133
+ private _clearReconnectTimeout;
134
+ private _clearServerPingTimeout;
135
+ private _waitServerPing;
136
+ private _getSubscribeContext;
137
+ private _handleReply;
138
+ private _handleJoin;
139
+ private _handleLeave;
140
+ private _handleUnsubscribe;
141
+ private _handleSubscribe;
142
+ private _handleDisconnect;
143
+ private _getPublicationContext;
144
+ private _getJoinLeaveContext;
145
+ private _handlePublication;
146
+ private _handleMessage;
147
+ private _handleServerPing;
148
+ private _handlePush;
149
+ private _flush;
150
+ private _createErrorObject;
151
+ private _registerCall;
152
+ private _addCommand;
153
+ private _nextPromiseId;
154
+ private _nextTransportId;
155
+ private _resolvePromises;
156
+ private _rejectPromises;
157
+ }
158
+ export {};
@@ -0,0 +1,158 @@
1
+ import { Subscription } from './subscription';
2
+ import { State, Options, ClientEvents, TypedEventEmitter, RpcResult, SubscriptionOptions, HistoryOptions, HistoryResult, PublishResult, PresenceResult, PresenceStatsResult, TransportEndpoint } from './types';
3
+ export declare class UnauthorizedError extends Error {
4
+ constructor(message: any);
5
+ }
6
+ declare const Centrifuge_base: new () => TypedEventEmitter<ClientEvents>;
7
+ /** Centrifuge is a Centrifuge/Centrifugo bidirectional client. */
8
+ export declare class Centrifuge extends Centrifuge_base {
9
+ state: State;
10
+ private _endpoint;
11
+ private _emulation;
12
+ private _transports;
13
+ private _currentTransportIndex;
14
+ private _triedAllTransports;
15
+ private _transportWasOpen;
16
+ private _transport?;
17
+ private _transportId;
18
+ private _deviceWentOffline;
19
+ private _transportClosed;
20
+ private _reconnecting;
21
+ private _reconnectTimeout?;
22
+ private _reconnectAttempts;
23
+ private _client;
24
+ private _session;
25
+ private _node;
26
+ private _subs;
27
+ private _serverSubs;
28
+ private _commandId;
29
+ private _commands;
30
+ private _batching;
31
+ private _refreshRequired;
32
+ private _refreshTimeout?;
33
+ private _callbacks;
34
+ private _token;
35
+ private _data;
36
+ private _dispatchPromise;
37
+ private _serverPing;
38
+ private _serverPingTimeout?;
39
+ private _sendPong;
40
+ private _promises;
41
+ private _promiseId;
42
+ private _networkEventsSet;
43
+ private _debugEnabled;
44
+ private _config;
45
+ protected _codec: any;
46
+ /** Constructs Centrifuge client. Call connect() method to start connecting. */
47
+ constructor(endpoint: string | Array<TransportEndpoint>, options?: Partial<Options>);
48
+ /** newSubscription allocates new Subscription to a channel. Since server only allows
49
+ * one subscription per channel per client this method throws if client already has
50
+ * channel subscription in internal registry.
51
+ * */
52
+ newSubscription(channel: string, options?: Partial<SubscriptionOptions>): Subscription;
53
+ /** getSubscription returns Subscription if it's registered in the internal
54
+ * registry or null. */
55
+ getSubscription(channel: string): Subscription | null;
56
+ /** removeSubscription allows removing Subcription from the internal registry. Subscrption
57
+ * must be in unsubscribed state. */
58
+ removeSubscription(sub: Subscription | null): void;
59
+ /** Get a map with all current client-side subscriptions. */
60
+ subscriptions(): Record<string, Subscription>;
61
+ /** ready returns a Promise which resolves upon client goes to Connected
62
+ * state and rejects in case of client goes to Disconnected or Failed state.
63
+ * Users can provide optional timeout in milliseconds. */
64
+ ready(timeout?: number): Promise<void>;
65
+ /** connect to a server. */
66
+ connect(): void;
67
+ /** disconnect from a server. */
68
+ disconnect(): void;
69
+ /** setToken allows setting connection token. Or resetting used token to be empty. */
70
+ setToken(token: string): void;
71
+ /** send asynchronous data to a server (without any response from a server
72
+ * expected, see rpc method if you need response). */
73
+ send(data: any): Promise<void>;
74
+ /** rpc to a server - i.e. a call which waits for a response with data. */
75
+ rpc(method: string, data: any): Promise<RpcResult>;
76
+ /** publish data to a channel. */
77
+ publish(channel: string, data: any): Promise<PublishResult>;
78
+ /** history for a channel. By default it does not return publications (only current
79
+ * StreamPosition data) – provide an explicit limit > 0 to load publications.*/
80
+ history(channel: string, options?: HistoryOptions): Promise<HistoryResult>;
81
+ /** presence for a channel. */
82
+ presence(channel: string): Promise<PresenceResult>;
83
+ /** presence stats for a channel. */
84
+ presenceStats(channel: string): Promise<PresenceStatsResult>;
85
+ /** start command batching (collect into temporary buffer without sending to a server)
86
+ * until stopBatching called.*/
87
+ startBatching(): void;
88
+ /** stop batching commands and flush collected commands to the
89
+ * network (all in one request/frame).*/
90
+ stopBatching(): void;
91
+ private _debug;
92
+ private _configure;
93
+ private _setState;
94
+ private _isDisconnected;
95
+ private _isConnecting;
96
+ private _isConnected;
97
+ private _nextCommandId;
98
+ private _setNetworkEvents;
99
+ private _getReconnectDelay;
100
+ private _clearOutgoingRequests;
101
+ private _clearConnectedState;
102
+ private _handleWriteError;
103
+ private _transportSendCommands;
104
+ private _initializeTransport;
105
+ private _sendConnect;
106
+ private _startReconnecting;
107
+ private _connectError;
108
+ private _scheduleReconnect;
109
+ private _constructConnectCommand;
110
+ private _getHistoryRequest;
111
+ private _methodCall;
112
+ private _callPromise;
113
+ private _dataReceived;
114
+ private _dispatchSynchronized;
115
+ private _dispatchReply;
116
+ private _call;
117
+ private _startConnecting;
118
+ private _disconnect;
119
+ private _failUnauthorized;
120
+ private _getToken;
121
+ private _refresh;
122
+ private _refreshError;
123
+ private _getRefreshRetryDelay;
124
+ private _refreshResponse;
125
+ private _removeSubscription;
126
+ protected _unsubscribe(sub: Subscription): void;
127
+ private _getSub;
128
+ private _isServerSub;
129
+ private _sendSubscribeCommands;
130
+ private _connectResponse;
131
+ private _processServerSubs;
132
+ private _clearRefreshTimeout;
133
+ private _clearReconnectTimeout;
134
+ private _clearServerPingTimeout;
135
+ private _waitServerPing;
136
+ private _getSubscribeContext;
137
+ private _handleReply;
138
+ private _handleJoin;
139
+ private _handleLeave;
140
+ private _handleUnsubscribe;
141
+ private _handleSubscribe;
142
+ private _handleDisconnect;
143
+ private _getPublicationContext;
144
+ private _getJoinLeaveContext;
145
+ private _handlePublication;
146
+ private _handleMessage;
147
+ private _handleServerPing;
148
+ private _handlePush;
149
+ private _flush;
150
+ private _createErrorObject;
151
+ private _registerCall;
152
+ private _addCommand;
153
+ private _nextPromiseId;
154
+ private _nextTransportId;
155
+ private _resolvePromises;
156
+ private _rejectPromises;
157
+ }
158
+ export {};
@@ -0,0 +1,36 @@
1
+ export declare enum errorCodes {
2
+ timeout = 1,
3
+ transportClosed = 2,
4
+ clientDisconnected = 3,
5
+ clientClosed = 4,
6
+ clientConnectToken = 5,
7
+ clientRefreshToken = 6,
8
+ subscriptionUnsubscribed = 7,
9
+ subscriptionSubscribeToken = 8,
10
+ subscriptionRefreshToken = 9,
11
+ transportWriteError = 10,
12
+ connectionClosed = 11,
13
+ badConfiguration = 12
14
+ }
15
+ export declare enum connectingCodes {
16
+ connectCalled = 0,
17
+ transportClosed = 1,
18
+ noPing = 2,
19
+ subscribeTimeout = 3,
20
+ unsubscribeError = 4
21
+ }
22
+ export declare enum disconnectedCodes {
23
+ disconnectCalled = 0,
24
+ unauthorized = 1,
25
+ badProtocol = 2,
26
+ messageSizeLimit = 3
27
+ }
28
+ export declare enum subscribingCodes {
29
+ subscribeCalled = 0,
30
+ transportClosed = 1
31
+ }
32
+ export declare enum unsubscribedCodes {
33
+ unsubscribeCalled = 0,
34
+ unauthorized = 1,
35
+ clientClosed = 2
36
+ }
@@ -0,0 +1,8 @@
1
+ import { Centrifuge, UnauthorizedError } from './centrifuge';
2
+ import { Subscription } from './subscription';
3
+ export * from "./types";
4
+ export * from "./codes";
5
+ declare class CentrifugeProtobuf extends Centrifuge {
6
+ protected _formatOverride(): void;
7
+ }
8
+ export { CentrifugeProtobuf as Centrifuge, UnauthorizedError, Subscription };