@@ -20,7 +20,7 @@ export declare class Client {
20
20
* If your environment does not support WebSockets natively, please refer to
21
21
* [Polyfills]{@link https://stomp-js.github.io/guide/stompjs/rx-stomp/ng2-stompjs/pollyfils-for-stompjs-v5.html}.
22
22
*/
23
- brokerURL : string ;
23
+ brokerURL : string | undefined ;
24
24
/**
25
25
* STOMP versions to attempt during STOMP handshake. By default versions `1.0`, `1.1`, and `1.2` are attempted.
26
26
*
@@ -52,7 +52,7 @@ export declare class Client {
52
52
* };
53
53
* ```
54
54
*/
55
- webSocketFactory : ( ) => IStompSocket ;
55
+ webSocketFactory : ( ( ) => IStompSocket ) | undefined ;
56
56
/**
57
57
* Will retry if Stomp connection is not established in specified milliseconds.
58
58
* Default 0, which implies wait for ever.
@@ -113,7 +113,7 @@ export declare class Client {
113
113
/**
114
114
* Underlying WebSocket instance, READONLY.
115
115
*/
116
- readonly webSocket : IStompSocket ;
116
+ get webSocket ( ) : IStompSocket | undefined ;
117
117
/**
118
118
* Connection headers, important keys - `login`, `passcode`, `host`.
119
119
* Though STOMP 1.2 standard marks these keys to be present, check your broker documentation for
@@ -123,7 +123,8 @@ export declare class Client {
123
123
/**
124
124
* Disconnection headers.
125
125
*/
126
- disconnectHeaders : StompHeaders ;
126
+ get disconnectHeaders ( ) : StompHeaders ;
127
+ set disconnectHeaders ( value : StompHeaders ) ;
127
128
private _disconnectHeaders ;
128
129
/**
129
130
* This function will be called for any unhandled messages.
@@ -153,7 +154,7 @@ export declare class Client {
153
154
/**
154
155
* `true` if there is a active connection with STOMP Broker
155
156
*/
156
- readonly connected : boolean ;
157
+ get connected ( ) : boolean ;
157
158
/**
158
159
* Callback, invoked on before a connection connection to the STOMP broker.
159
160
*
@@ -242,20 +243,19 @@ export declare class Client {
242
243
/**
243
244
* version of STOMP protocol negotiated with the server, READONLY
244
245
*/
245
- readonly connectedVersion : string ;
246
+ get connectedVersion ( ) : string | undefined ;
246
247
private _stompHandler ;
247
248
/**
248
249
* if the client is active (connected or going to reconnect)
249
250
*/
250
- readonly active : boolean ;
251
+ get active ( ) : boolean ;
251
252
/**
252
253
* It will be called on state change.
253
254
*
254
255
* When deactivating it may go from ACTIVE to INACTIVE without entering DEACTIVATING.
255
256
*/
256
257
onChangeState : ( state : ActivationState ) => void ;
257
258
private _changeState ;
258
- private _resolveSocketClose ;
259
259
/**
260
260
* Activation state.
261
261
*
@@ -285,14 +285,29 @@ export declare class Client {
285
285
private _schedule_reconnect ;
286
286
/**
287
287
* Disconnect if connected and stop auto reconnect loop.
288
- * Appropriate callbacks will be invoked if underlying STOMP connection was connected .
288
+ * Appropriate callbacks will be invoked if there is an underlying STOMP connection.
289
289
*
290
- * This call is async, it will resolve immediately if there is no underlying active websocket,
291
- * otherwise, it will resolve after underlying websocket is properly disposed.
290
+ * This call is async. It will resolve immediately if there is no underlying active websocket,
291
+ * otherwise, it will resolve after the underlying websocket is properly disposed of .
292
292
*
293
- * To reactivate you can call [Client#activate]{@link Client#activate}.
293
+ * It is not an error to invoke this method more than once.
294
+ * Each of those would resolve on completion of deactivation.
295
+ *
296
+ * To reactivate, you can call [Client#activate]{@link Client#activate}.
297
+ *
298
+ * Experimental: pass `force: true` to immediately discard the underlying connection.
299
+ * This mode will skip both the STOMP and the Websocket shutdown sequences.
300
+ * In some cases, browsers take a long time in the Websocket shutdown if the underlying connection had gone stale.
301
+ * Using this mode can speed up.
302
+ * When this mode is used, the actual Websocket may linger for a while
303
+ * and the broker may not realize that the connection is no longer in use.
304
+ *
305
+ * It is possible to invoke this method initially without the `force` option
306
+ * and subsequently, say after a wait, with the `force` option.
294
307
*/
295
- deactivate ( ) : Promise < void > ;
308
+ deactivate ( options ?: {
309
+ force ?: boolean ;
310
+ } ) : Promise < void > ;
296
311
/**
297
312
* Force disconnect if there is an active connection by directly closing the underlying WebSocket.
298
313
* This is different than a normal disconnect where a DISCONNECT sequence is carried out with the broker.
@@ -338,6 +353,7 @@ export declare class Client {
338
353
* ```
339
354
*/
340
355
publish ( params : IPublishParams ) : void ;
356
+ private _checkConnection ;
341
357
/**
342
358
* STOMP brokers may carry out operation asynchronously and allow requesting for acknowledgement.
343
359
* To request an acknowledgement, a `receipt` header needs to be sent with the actual request.
0 commit comments