die heldin script add
This commit is contained in:
5
node_modules/@stomp/stompjs/esm6/augment-websocket.d.ts
generated
vendored
Normal file
5
node_modules/@stomp/stompjs/esm6/augment-websocket.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { IStompSocket } from './types';
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function augmentWebsocket(webSocket: IStompSocket, debug: (msg: string) => void): void;
|
||||
26
node_modules/@stomp/stompjs/esm6/augment-websocket.js
generated
vendored
Normal file
26
node_modules/@stomp/stompjs/esm6/augment-websocket.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function augmentWebsocket(webSocket, debug) {
|
||||
webSocket.terminate = function () {
|
||||
const noOp = () => { };
|
||||
// set all callbacks to no op
|
||||
this.onerror = noOp;
|
||||
this.onmessage = noOp;
|
||||
this.onopen = noOp;
|
||||
const ts = new Date();
|
||||
const origOnClose = this.onclose;
|
||||
// Track delay in actual closure of the socket
|
||||
this.onclose = closeEvent => {
|
||||
const delay = new Date().getTime() - ts.getTime();
|
||||
debug(`Discarded socket closed after ${delay}ms, with code/reason: ${closeEvent.code}/${closeEvent.reason}`);
|
||||
};
|
||||
this.close();
|
||||
origOnClose.call(this, {
|
||||
code: 4001,
|
||||
reason: 'Heartbeat failure, discarding the socket',
|
||||
wasClean: false,
|
||||
});
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=augment-websocket.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/augment-websocket.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/augment-websocket.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"augment-websocket.js","sourceRoot":"","sources":["../src/augment-websocket.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAAuB,EACvB,KAA4B;IAE5B,SAAS,CAAC,SAAS,GAAG;QACpB,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;QAEtB,6BAA6B;QAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAEnB,MAAM,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC;QAEtB,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC;QAEjC,8CAA8C;QAC9C,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,EAAE;YAC1B,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;YAClD,KAAK,CACH,iCAAiC,KAAK,yBAAyB,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,MAAM,EAAE,CACtG,CAAC;QACJ,CAAC,CAAC;QAEF,IAAI,CAAC,KAAK,EAAE,CAAC;QAEb,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE;YACrB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,0CAA0C;YAClD,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
||||
11
node_modules/@stomp/stompjs/esm6/byte.d.ts
generated
vendored
Normal file
11
node_modules/@stomp/stompjs/esm6/byte.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Some byte values, used as per STOMP specifications.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export declare const BYTE: {
|
||||
LF: string;
|
||||
NULL: string;
|
||||
};
|
||||
14
node_modules/@stomp/stompjs/esm6/byte.js
generated
vendored
Normal file
14
node_modules/@stomp/stompjs/esm6/byte.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Some byte values, used as per STOMP specifications.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export const BYTE = {
|
||||
// LINEFEED byte (octet 10)
|
||||
LF: '\x0A',
|
||||
// NULL byte (octet 0)
|
||||
NULL: '\x00',
|
||||
};
|
||||
//# sourceMappingURL=byte.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/byte.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/byte.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"byte.js","sourceRoot":"","sources":["../src/byte.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,2BAA2B;IAC3B,EAAE,EAAE,MAAM;IACV,sBAAsB;IACtB,IAAI,EAAE,MAAM;CACb,CAAC"}
|
||||
475
node_modules/@stomp/stompjs/esm6/client.d.ts
generated
vendored
Normal file
475
node_modules/@stomp/stompjs/esm6/client.d.ts
generated
vendored
Normal file
@@ -0,0 +1,475 @@
|
||||
import { ITransaction } from './i-transaction';
|
||||
import { StompConfig } from './stomp-config';
|
||||
import { StompHeaders } from './stomp-headers';
|
||||
import { StompSubscription } from './stomp-subscription';
|
||||
import { ActivationState, closeEventCallbackType, debugFnType, frameCallbackType, IPublishParams, IStompSocket, messageCallbackType, wsErrorCallbackType } from './types';
|
||||
import { Versions } from './versions';
|
||||
/**
|
||||
* STOMP Client Class.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export declare class Client {
|
||||
/**
|
||||
* The URL for the STOMP broker to connect to.
|
||||
* Typically like `"ws://broker.329broker.com:15674/ws"` or `"wss://broker.329broker.com:15674/ws"`.
|
||||
*
|
||||
* Only one of this or [Client#webSocketFactory]{@link Client#webSocketFactory} need to be set.
|
||||
* If both are set, [Client#webSocketFactory]{@link Client#webSocketFactory} will be used.
|
||||
*
|
||||
* If your environment does not support WebSockets natively, please refer to
|
||||
* [Polyfills]{@link https://stomp-js.github.io/guide/stompjs/rx-stomp/ng2-stompjs/pollyfils-for-stompjs-v5.html}.
|
||||
*/
|
||||
brokerURL: string;
|
||||
/**
|
||||
* STOMP versions to attempt during STOMP handshake. By default versions `1.0`, `1.1`, and `1.2` are attempted.
|
||||
*
|
||||
* Example:
|
||||
* ```javascript
|
||||
* // Try only versions 1.0 and 1.1
|
||||
* client.stompVersions = new Versions(['1.0', '1.1'])
|
||||
* ```
|
||||
*/
|
||||
stompVersions: Versions;
|
||||
/**
|
||||
* This function should return a WebSocket or a similar (e.g. SockJS) object.
|
||||
* If your environment does not support WebSockets natively, please refer to
|
||||
* [Polyfills]{@link https://stomp-js.github.io/guide/stompjs/rx-stomp/ng2-stompjs/pollyfils-for-stompjs-v5.html}.
|
||||
* If your STOMP Broker supports WebSockets, prefer setting [Client#brokerURL]{@link Client#brokerURL}.
|
||||
*
|
||||
* If both this and [Client#brokerURL]{@link Client#brokerURL} are set, this will be used.
|
||||
*
|
||||
* Example:
|
||||
* ```javascript
|
||||
* // use a WebSocket
|
||||
* client.webSocketFactory= function () {
|
||||
* return new WebSocket("wss://broker.329broker.com:15674/ws");
|
||||
* };
|
||||
*
|
||||
* // Typical usage with SockJS
|
||||
* client.webSocketFactory= function () {
|
||||
* return new SockJS("http://broker.329broker.com/stomp");
|
||||
* };
|
||||
* ```
|
||||
*/
|
||||
webSocketFactory: () => IStompSocket;
|
||||
/**
|
||||
* Will retry if Stomp connection is not established in specified milliseconds.
|
||||
* Default 0, which implies wait for ever.
|
||||
*/
|
||||
connectionTimeout: number;
|
||||
private _connectionWatcher;
|
||||
/**
|
||||
* automatically reconnect with delay in milliseconds, set to 0 to disable.
|
||||
*/
|
||||
reconnectDelay: number;
|
||||
/**
|
||||
* Incoming heartbeat interval in milliseconds. Set to 0 to disable.
|
||||
*/
|
||||
heartbeatIncoming: number;
|
||||
/**
|
||||
* Outgoing heartbeat interval in milliseconds. Set to 0 to disable.
|
||||
*/
|
||||
heartbeatOutgoing: number;
|
||||
/**
|
||||
* This switches on a non standard behavior while sending WebSocket packets.
|
||||
* It splits larger (text) packets into chunks of [maxWebSocketChunkSize]{@link Client#maxWebSocketChunkSize}.
|
||||
* Only Java Spring brokers seems to use this mode.
|
||||
*
|
||||
* WebSockets, by itself, split large (text) packets,
|
||||
* so it is not needed with a truly compliant STOMP/WebSocket broker.
|
||||
* Actually setting it for such broker will cause large messages to fail.
|
||||
*
|
||||
* `false` by default.
|
||||
*
|
||||
* Binary frames are never split.
|
||||
*/
|
||||
splitLargeFrames: boolean;
|
||||
/**
|
||||
* See [splitLargeFrames]{@link Client#splitLargeFrames}.
|
||||
* This has no effect if [splitLargeFrames]{@link Client#splitLargeFrames} is `false`.
|
||||
*/
|
||||
maxWebSocketChunkSize: number;
|
||||
/**
|
||||
* Usually the
|
||||
* [type of WebSocket frame]{@link https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send#Parameters}
|
||||
* is automatically decided by type of the payload.
|
||||
* Default is `false`, which should work with all compliant brokers.
|
||||
*
|
||||
* Set this flag to force binary frames.
|
||||
*/
|
||||
forceBinaryWSFrames: boolean;
|
||||
/**
|
||||
* A bug in ReactNative chops a string on occurrence of a NULL.
|
||||
* See issue [https://github.com/stomp-js/stompjs/issues/89]{@link https://github.com/stomp-js/stompjs/issues/89}.
|
||||
* This makes incoming WebSocket messages invalid STOMP packets.
|
||||
* Setting this flag attempts to reverse the damage by appending a NULL.
|
||||
* If the broker splits a large message into multiple WebSocket messages,
|
||||
* this flag will cause data loss and abnormal termination of connection.
|
||||
*
|
||||
* This is not an ideal solution, but a stop gap until the underlying issue is fixed at ReactNative library.
|
||||
*/
|
||||
appendMissingNULLonIncoming: boolean;
|
||||
/**
|
||||
* Underlying WebSocket instance, READONLY.
|
||||
*/
|
||||
readonly webSocket: IStompSocket;
|
||||
/**
|
||||
* Connection headers, important keys - `login`, `passcode`, `host`.
|
||||
* Though STOMP 1.2 standard marks these keys to be present, check your broker documentation for
|
||||
* details specific to your broker.
|
||||
*/
|
||||
connectHeaders: StompHeaders;
|
||||
/**
|
||||
* Disconnection headers.
|
||||
*/
|
||||
disconnectHeaders: StompHeaders;
|
||||
private _disconnectHeaders;
|
||||
/**
|
||||
* This function will be called for any unhandled messages.
|
||||
* It is useful for receiving messages sent to RabbitMQ temporary queues.
|
||||
*
|
||||
* It can also get invoked with stray messages while the server is processing
|
||||
* a request to [Client#unsubscribe]{@link Client#unsubscribe}
|
||||
* from an endpoint.
|
||||
*
|
||||
* The actual {@link IMessage} will be passed as parameter to the callback.
|
||||
*/
|
||||
onUnhandledMessage: messageCallbackType;
|
||||
/**
|
||||
* STOMP brokers can be requested to notify when an operation is actually completed.
|
||||
* Prefer using [Client#watchForReceipt]{@link Client#watchForReceipt}. See
|
||||
* [Client#watchForReceipt]{@link Client#watchForReceipt} for examples.
|
||||
*
|
||||
* The actual {@link FrameImpl} will be passed as parameter to the callback.
|
||||
*/
|
||||
onUnhandledReceipt: frameCallbackType;
|
||||
/**
|
||||
* Will be invoked if {@link FrameImpl} of unknown type is received from the STOMP broker.
|
||||
*
|
||||
* The actual {@link IFrame} will be passed as parameter to the callback.
|
||||
*/
|
||||
onUnhandledFrame: frameCallbackType;
|
||||
/**
|
||||
* `true` if there is a active connection with STOMP Broker
|
||||
*/
|
||||
readonly connected: boolean;
|
||||
/**
|
||||
* Callback, invoked on before a connection connection to the STOMP broker.
|
||||
*
|
||||
* You can change options on the client, which will impact the immediate connect.
|
||||
* It is valid to call [Client#decativate]{@link Client#deactivate} in this callback.
|
||||
*
|
||||
* As of version 5.1, this callback can be
|
||||
* [async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function)
|
||||
* (i.e., it can return a
|
||||
* [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)).
|
||||
* In that case connect will be called only after the Promise is resolved.
|
||||
* This can be used to reliably fetch credentials, access token etc. from some other service
|
||||
* in an asynchronous way.
|
||||
*/
|
||||
beforeConnect: () => void | Promise<void>;
|
||||
/**
|
||||
* Callback, invoked on every successful connection to the STOMP broker.
|
||||
*
|
||||
* The actual {@link FrameImpl} will be passed as parameter to the callback.
|
||||
* Sometimes clients will like to use headers from this frame.
|
||||
*/
|
||||
onConnect: frameCallbackType;
|
||||
/**
|
||||
* Callback, invoked on every successful disconnection from the STOMP broker. It will not be invoked if
|
||||
* the STOMP broker disconnected due to an error.
|
||||
*
|
||||
* The actual Receipt {@link FrameImpl} acknowledging the DISCONNECT will be passed as parameter to the callback.
|
||||
*
|
||||
* The way STOMP protocol is designed, the connection may close/terminate without the client
|
||||
* receiving the Receipt {@link FrameImpl} acknowledging the DISCONNECT.
|
||||
* You might find [Client#onWebSocketClose]{@link Client#onWebSocketClose} more appropriate to watch
|
||||
* STOMP broker disconnects.
|
||||
*/
|
||||
onDisconnect: frameCallbackType;
|
||||
/**
|
||||
* Callback, invoked on an ERROR frame received from the STOMP Broker.
|
||||
* A compliant STOMP Broker will close the connection after this type of frame.
|
||||
* Please check broker specific documentation for exact behavior.
|
||||
*
|
||||
* The actual {@link IFrame} will be passed as parameter to the callback.
|
||||
*/
|
||||
onStompError: frameCallbackType;
|
||||
/**
|
||||
* Callback, invoked when underlying WebSocket is closed.
|
||||
*
|
||||
* Actual [CloseEvent]{@link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent}
|
||||
* is passed as parameter to the callback.
|
||||
*/
|
||||
onWebSocketClose: closeEventCallbackType;
|
||||
/**
|
||||
* Callback, invoked when underlying WebSocket raises an error.
|
||||
*
|
||||
* Actual [Event]{@link https://developer.mozilla.org/en-US/docs/Web/API/Event}
|
||||
* is passed as parameter to the callback.
|
||||
*/
|
||||
onWebSocketError: wsErrorCallbackType;
|
||||
/**
|
||||
* Set it to log the actual raw communication with the broker.
|
||||
* When unset, it logs headers of the parsed frames.
|
||||
*
|
||||
* Change in this effects from next broker reconnect.
|
||||
*
|
||||
* **Caution: this assumes that frames only have valid UTF8 strings.**
|
||||
*/
|
||||
logRawCommunication: boolean;
|
||||
/**
|
||||
* By default, debug messages are discarded. To log to `console` following can be used:
|
||||
*
|
||||
* ```javascript
|
||||
* client.debug = function(str) {
|
||||
* console.log(str);
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* Currently this method does not support levels of log. Be aware that the output can be quite verbose
|
||||
* and may contain sensitive information (like passwords, tokens etc.).
|
||||
*/
|
||||
debug: debugFnType;
|
||||
/**
|
||||
* Browsers do not immediately close WebSockets when `.close` is issued.
|
||||
* This may cause reconnection to take a longer on certain type of failures.
|
||||
* In case of incoming heartbeat failure, this experimental flag instructs the library
|
||||
* to discard the socket immediately (even before it is actually closed).
|
||||
*/
|
||||
discardWebsocketOnCommFailure: boolean;
|
||||
/**
|
||||
* version of STOMP protocol negotiated with the server, READONLY
|
||||
*/
|
||||
readonly connectedVersion: string;
|
||||
private _stompHandler;
|
||||
/**
|
||||
* if the client is active (connected or going to reconnect)
|
||||
*/
|
||||
readonly active: boolean;
|
||||
/**
|
||||
* It will be called on state change.
|
||||
*
|
||||
* When deactivating it may go from ACTIVE to INACTIVE without entering DEACTIVATING.
|
||||
*/
|
||||
onChangeState: (state: ActivationState) => void;
|
||||
private _changeState;
|
||||
private _resolveSocketClose;
|
||||
/**
|
||||
* Activation state.
|
||||
*
|
||||
* It will usually be ACTIVE or INACTIVE.
|
||||
* When deactivating it may go from ACTIVE to INACTIVE without entering DEACTIVATING.
|
||||
*/
|
||||
state: ActivationState;
|
||||
private _reconnector;
|
||||
/**
|
||||
* Create an instance.
|
||||
*/
|
||||
constructor(conf?: StompConfig);
|
||||
/**
|
||||
* Update configuration.
|
||||
*/
|
||||
configure(conf: StompConfig): void;
|
||||
/**
|
||||
* Initiate the connection with the broker.
|
||||
* If the connection breaks, as per [Client#reconnectDelay]{@link Client#reconnectDelay},
|
||||
* it will keep trying to reconnect.
|
||||
*
|
||||
* Call [Client#deactivate]{@link Client#deactivate} to disconnect and stop reconnection attempts.
|
||||
*/
|
||||
activate(): void;
|
||||
private _connect;
|
||||
private _createWebSocket;
|
||||
private _schedule_reconnect;
|
||||
/**
|
||||
* Disconnect if connected and stop auto reconnect loop.
|
||||
* Appropriate callbacks will be invoked if underlying STOMP connection was connected.
|
||||
*
|
||||
* This call is async, it will resolve immediately if there is no underlying active websocket,
|
||||
* otherwise, it will resolve after underlying websocket is properly disposed.
|
||||
*
|
||||
* To reactivate you can call [Client#activate]{@link Client#activate}.
|
||||
*/
|
||||
deactivate(): Promise<void>;
|
||||
/**
|
||||
* Force disconnect if there is an active connection by directly closing the underlying WebSocket.
|
||||
* This is different than a normal disconnect where a DISCONNECT sequence is carried out with the broker.
|
||||
* After forcing disconnect, automatic reconnect will be attempted.
|
||||
* To stop further reconnects call [Client#deactivate]{@link Client#deactivate} as well.
|
||||
*/
|
||||
forceDisconnect(): void;
|
||||
private _disposeStompHandler;
|
||||
/**
|
||||
* Send a message to a named destination. Refer to your STOMP broker documentation for types
|
||||
* and naming of destinations.
|
||||
*
|
||||
* STOMP protocol specifies and suggests some headers and also allows broker specific headers.
|
||||
*
|
||||
* `body` must be String.
|
||||
* You will need to covert the payload to string in case it is not string (e.g. JSON).
|
||||
*
|
||||
* To send a binary message body use binaryBody parameter. It should be a
|
||||
* [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).
|
||||
* Sometimes brokers may not support binary frames out of the box.
|
||||
* Please check your broker documentation.
|
||||
*
|
||||
* `content-length` header is automatically added to the STOMP Frame sent to the broker.
|
||||
* Set `skipContentLengthHeader` to indicate that `content-length` header should not be added.
|
||||
* For binary messages `content-length` header is always added.
|
||||
*
|
||||
* Caution: The broker will, most likely, report an error and disconnect if message body has NULL octet(s)
|
||||
* and `content-length` header is missing.
|
||||
*
|
||||
* ```javascript
|
||||
* client.publish({destination: "/queue/test", headers: {priority: 9}, body: "Hello, STOMP"});
|
||||
*
|
||||
* // Only destination is mandatory parameter
|
||||
* client.publish({destination: "/queue/test", body: "Hello, STOMP"});
|
||||
*
|
||||
* // Skip content-length header in the frame to the broker
|
||||
* client.publish({"/queue/test", body: "Hello, STOMP", skipContentLengthHeader: true});
|
||||
*
|
||||
* var binaryData = generateBinaryData(); // This need to be of type Uint8Array
|
||||
* // setting content-type header is not mandatory, however a good practice
|
||||
* client.publish({destination: '/topic/special', binaryBody: binaryData,
|
||||
* headers: {'content-type': 'application/octet-stream'}});
|
||||
* ```
|
||||
*/
|
||||
publish(params: IPublishParams): void;
|
||||
/**
|
||||
* STOMP brokers may carry out operation asynchronously and allow requesting for acknowledgement.
|
||||
* To request an acknowledgement, a `receipt` header needs to be sent with the actual request.
|
||||
* The value (say receipt-id) for this header needs to be unique for each use. Typically a sequence, a UUID, a
|
||||
* random number or a combination may be used.
|
||||
*
|
||||
* A complaint broker will send a RECEIPT frame when an operation has actually been completed.
|
||||
* The operation needs to be matched based in the value of the receipt-id.
|
||||
*
|
||||
* This method allow watching for a receipt and invoke the callback
|
||||
* when corresponding receipt has been received.
|
||||
*
|
||||
* The actual {@link FrameImpl} will be passed as parameter to the callback.
|
||||
*
|
||||
* Example:
|
||||
* ```javascript
|
||||
* // Subscribing with acknowledgement
|
||||
* let receiptId = randomText();
|
||||
*
|
||||
* client.watchForReceipt(receiptId, function() {
|
||||
* // Will be called after server acknowledges
|
||||
* });
|
||||
*
|
||||
* client.subscribe(TEST.destination, onMessage, {receipt: receiptId});
|
||||
*
|
||||
*
|
||||
* // Publishing with acknowledgement
|
||||
* receiptId = randomText();
|
||||
*
|
||||
* client.watchForReceipt(receiptId, function() {
|
||||
* // Will be called after server acknowledges
|
||||
* });
|
||||
* client.publish({destination: TEST.destination, headers: {receipt: receiptId}, body: msg});
|
||||
* ```
|
||||
*/
|
||||
watchForReceipt(receiptId: string, callback: frameCallbackType): void;
|
||||
/**
|
||||
* Subscribe to a STOMP Broker location. The callback will be invoked for each received message with
|
||||
* the {@link IMessage} as argument.
|
||||
*
|
||||
* Note: The library will generate an unique ID if there is none provided in the headers.
|
||||
* To use your own ID, pass it using the headers argument.
|
||||
*
|
||||
* ```javascript
|
||||
* callback = function(message) {
|
||||
* // called when the client receives a STOMP message from the server
|
||||
* if (message.body) {
|
||||
* alert("got message with body " + message.body)
|
||||
* } else {
|
||||
* alert("got empty message");
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* var subscription = client.subscribe("/queue/test", callback);
|
||||
*
|
||||
* // Explicit subscription id
|
||||
* var mySubId = 'my-subscription-id-001';
|
||||
* var subscription = client.subscribe(destination, callback, { id: mySubId });
|
||||
* ```
|
||||
*/
|
||||
subscribe(destination: string, callback: messageCallbackType, headers?: StompHeaders): StompSubscription;
|
||||
/**
|
||||
* It is preferable to unsubscribe from a subscription by calling
|
||||
* `unsubscribe()` directly on {@link StompSubscription} returned by `client.subscribe()`:
|
||||
*
|
||||
* ```javascript
|
||||
* var subscription = client.subscribe(destination, onmessage);
|
||||
* // ...
|
||||
* subscription.unsubscribe();
|
||||
* ```
|
||||
*
|
||||
* See: http://stomp.github.com/stomp-specification-1.2.html#UNSUBSCRIBE UNSUBSCRIBE Frame
|
||||
*/
|
||||
unsubscribe(id: string, headers?: StompHeaders): void;
|
||||
/**
|
||||
* Start a transaction, the returned {@link ITransaction} has methods - [commit]{@link ITransaction#commit}
|
||||
* and [abort]{@link ITransaction#abort}.
|
||||
*
|
||||
* `transactionId` is optional, if not passed the library will generate it internally.
|
||||
*/
|
||||
begin(transactionId?: string): ITransaction;
|
||||
/**
|
||||
* Commit a transaction.
|
||||
*
|
||||
* It is preferable to commit a transaction by calling [commit]{@link ITransaction#commit} directly on
|
||||
* {@link ITransaction} returned by [client.begin]{@link Client#begin}.
|
||||
*
|
||||
* ```javascript
|
||||
* var tx = client.begin(txId);
|
||||
* //...
|
||||
* tx.commit();
|
||||
* ```
|
||||
*/
|
||||
commit(transactionId: string): void;
|
||||
/**
|
||||
* Abort a transaction.
|
||||
* It is preferable to abort a transaction by calling [abort]{@link ITransaction#abort} directly on
|
||||
* {@link ITransaction} returned by [client.begin]{@link Client#begin}.
|
||||
*
|
||||
* ```javascript
|
||||
* var tx = client.begin(txId);
|
||||
* //...
|
||||
* tx.abort();
|
||||
* ```
|
||||
*/
|
||||
abort(transactionId: string): void;
|
||||
/**
|
||||
* ACK a message. It is preferable to acknowledge a message by calling [ack]{@link IMessage#ack} directly
|
||||
* on the {@link IMessage} handled by a subscription callback:
|
||||
*
|
||||
* ```javascript
|
||||
* var callback = function (message) {
|
||||
* // process the message
|
||||
* // acknowledge it
|
||||
* message.ack();
|
||||
* };
|
||||
* client.subscribe(destination, callback, {'ack': 'client'});
|
||||
* ```
|
||||
*/
|
||||
ack(messageId: string, subscriptionId: string, headers?: StompHeaders): void;
|
||||
/**
|
||||
* NACK a message. It is preferable to acknowledge a message by calling [nack]{@link IMessage#nack} directly
|
||||
* on the {@link IMessage} handled by a subscription callback:
|
||||
*
|
||||
* ```javascript
|
||||
* var callback = function (message) {
|
||||
* // process the message
|
||||
* // an error occurs, nack it
|
||||
* message.nack();
|
||||
* };
|
||||
* client.subscribe(destination, callback, {'ack': 'client'});
|
||||
* ```
|
||||
*/
|
||||
nack(messageId: string, subscriptionId: string, headers?: StompHeaders): void;
|
||||
}
|
||||
539
node_modules/@stomp/stompjs/esm6/client.js
generated
vendored
Normal file
539
node_modules/@stomp/stompjs/esm6/client.js
generated
vendored
Normal file
@@ -0,0 +1,539 @@
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
import { StompHandler } from './stomp-handler';
|
||||
import { ActivationState, StompSocketState, } from './types';
|
||||
import { Versions } from './versions';
|
||||
/**
|
||||
* STOMP Client Class.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export class Client {
|
||||
/**
|
||||
* Create an instance.
|
||||
*/
|
||||
constructor(conf = {}) {
|
||||
/**
|
||||
* STOMP versions to attempt during STOMP handshake. By default versions `1.0`, `1.1`, and `1.2` are attempted.
|
||||
*
|
||||
* Example:
|
||||
* ```javascript
|
||||
* // Try only versions 1.0 and 1.1
|
||||
* client.stompVersions = new Versions(['1.0', '1.1'])
|
||||
* ```
|
||||
*/
|
||||
this.stompVersions = Versions.default;
|
||||
/**
|
||||
* Will retry if Stomp connection is not established in specified milliseconds.
|
||||
* Default 0, which implies wait for ever.
|
||||
*/
|
||||
this.connectionTimeout = 0;
|
||||
/**
|
||||
* automatically reconnect with delay in milliseconds, set to 0 to disable.
|
||||
*/
|
||||
this.reconnectDelay = 5000;
|
||||
/**
|
||||
* Incoming heartbeat interval in milliseconds. Set to 0 to disable.
|
||||
*/
|
||||
this.heartbeatIncoming = 10000;
|
||||
/**
|
||||
* Outgoing heartbeat interval in milliseconds. Set to 0 to disable.
|
||||
*/
|
||||
this.heartbeatOutgoing = 10000;
|
||||
/**
|
||||
* This switches on a non standard behavior while sending WebSocket packets.
|
||||
* It splits larger (text) packets into chunks of [maxWebSocketChunkSize]{@link Client#maxWebSocketChunkSize}.
|
||||
* Only Java Spring brokers seems to use this mode.
|
||||
*
|
||||
* WebSockets, by itself, split large (text) packets,
|
||||
* so it is not needed with a truly compliant STOMP/WebSocket broker.
|
||||
* Actually setting it for such broker will cause large messages to fail.
|
||||
*
|
||||
* `false` by default.
|
||||
*
|
||||
* Binary frames are never split.
|
||||
*/
|
||||
this.splitLargeFrames = false;
|
||||
/**
|
||||
* See [splitLargeFrames]{@link Client#splitLargeFrames}.
|
||||
* This has no effect if [splitLargeFrames]{@link Client#splitLargeFrames} is `false`.
|
||||
*/
|
||||
this.maxWebSocketChunkSize = 8 * 1024;
|
||||
/**
|
||||
* Usually the
|
||||
* [type of WebSocket frame]{@link https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send#Parameters}
|
||||
* is automatically decided by type of the payload.
|
||||
* Default is `false`, which should work with all compliant brokers.
|
||||
*
|
||||
* Set this flag to force binary frames.
|
||||
*/
|
||||
this.forceBinaryWSFrames = false;
|
||||
/**
|
||||
* A bug in ReactNative chops a string on occurrence of a NULL.
|
||||
* See issue [https://github.com/stomp-js/stompjs/issues/89]{@link https://github.com/stomp-js/stompjs/issues/89}.
|
||||
* This makes incoming WebSocket messages invalid STOMP packets.
|
||||
* Setting this flag attempts to reverse the damage by appending a NULL.
|
||||
* If the broker splits a large message into multiple WebSocket messages,
|
||||
* this flag will cause data loss and abnormal termination of connection.
|
||||
*
|
||||
* This is not an ideal solution, but a stop gap until the underlying issue is fixed at ReactNative library.
|
||||
*/
|
||||
this.appendMissingNULLonIncoming = false;
|
||||
/**
|
||||
* Activation state.
|
||||
*
|
||||
* It will usually be ACTIVE or INACTIVE.
|
||||
* When deactivating it may go from ACTIVE to INACTIVE without entering DEACTIVATING.
|
||||
*/
|
||||
this.state = ActivationState.INACTIVE;
|
||||
// Dummy callbacks
|
||||
const noOp = () => { };
|
||||
this.debug = noOp;
|
||||
this.beforeConnect = noOp;
|
||||
this.onConnect = noOp;
|
||||
this.onDisconnect = noOp;
|
||||
this.onUnhandledMessage = noOp;
|
||||
this.onUnhandledReceipt = noOp;
|
||||
this.onUnhandledFrame = noOp;
|
||||
this.onStompError = noOp;
|
||||
this.onWebSocketClose = noOp;
|
||||
this.onWebSocketError = noOp;
|
||||
this.logRawCommunication = false;
|
||||
this.onChangeState = noOp;
|
||||
// These parameters would typically get proper values before connect is called
|
||||
this.connectHeaders = {};
|
||||
this._disconnectHeaders = {};
|
||||
// Apply configuration
|
||||
this.configure(conf);
|
||||
}
|
||||
/**
|
||||
* Underlying WebSocket instance, READONLY.
|
||||
*/
|
||||
get webSocket() {
|
||||
return this._stompHandler ? this._stompHandler._webSocket : undefined;
|
||||
}
|
||||
/**
|
||||
* Disconnection headers.
|
||||
*/
|
||||
get disconnectHeaders() {
|
||||
return this._disconnectHeaders;
|
||||
}
|
||||
set disconnectHeaders(value) {
|
||||
this._disconnectHeaders = value;
|
||||
if (this._stompHandler) {
|
||||
this._stompHandler.disconnectHeaders = this._disconnectHeaders;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* `true` if there is a active connection with STOMP Broker
|
||||
*/
|
||||
get connected() {
|
||||
return !!this._stompHandler && this._stompHandler.connected;
|
||||
}
|
||||
/**
|
||||
* version of STOMP protocol negotiated with the server, READONLY
|
||||
*/
|
||||
get connectedVersion() {
|
||||
return this._stompHandler ? this._stompHandler.connectedVersion : undefined;
|
||||
}
|
||||
/**
|
||||
* if the client is active (connected or going to reconnect)
|
||||
*/
|
||||
get active() {
|
||||
return this.state === ActivationState.ACTIVE;
|
||||
}
|
||||
_changeState(state) {
|
||||
this.state = state;
|
||||
this.onChangeState(state);
|
||||
}
|
||||
/**
|
||||
* Update configuration.
|
||||
*/
|
||||
configure(conf) {
|
||||
// bulk assign all properties to this
|
||||
Object.assign(this, conf);
|
||||
}
|
||||
/**
|
||||
* Initiate the connection with the broker.
|
||||
* If the connection breaks, as per [Client#reconnectDelay]{@link Client#reconnectDelay},
|
||||
* it will keep trying to reconnect.
|
||||
*
|
||||
* Call [Client#deactivate]{@link Client#deactivate} to disconnect and stop reconnection attempts.
|
||||
*/
|
||||
activate() {
|
||||
if (this.state === ActivationState.DEACTIVATING) {
|
||||
this.debug('Still DEACTIVATING, please await call to deactivate before trying to re-activate');
|
||||
throw new Error('Still DEACTIVATING, can not activate now');
|
||||
}
|
||||
if (this.active) {
|
||||
this.debug('Already ACTIVE, ignoring request to activate');
|
||||
return;
|
||||
}
|
||||
this._changeState(ActivationState.ACTIVE);
|
||||
this._connect();
|
||||
}
|
||||
_connect() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (this.connected) {
|
||||
this.debug('STOMP: already connected, nothing to do');
|
||||
return;
|
||||
}
|
||||
yield this.beforeConnect();
|
||||
if (!this.active) {
|
||||
this.debug('Client has been marked inactive, will not attempt to connect');
|
||||
return;
|
||||
}
|
||||
// setup connection watcher
|
||||
if (this.connectionTimeout > 0) {
|
||||
// clear first
|
||||
if (this._connectionWatcher) {
|
||||
clearTimeout(this._connectionWatcher);
|
||||
}
|
||||
this._connectionWatcher = setTimeout(() => {
|
||||
if (this.connected) {
|
||||
return;
|
||||
}
|
||||
// Connection not established, close the underlying socket
|
||||
// a reconnection will be attempted
|
||||
this.debug(`Connection not established in ${this.connectionTimeout}ms, closing socket`);
|
||||
this.forceDisconnect();
|
||||
}, this.connectionTimeout);
|
||||
}
|
||||
this.debug('Opening Web Socket...');
|
||||
// Get the actual WebSocket (or a similar object)
|
||||
const webSocket = this._createWebSocket();
|
||||
this._stompHandler = new StompHandler(this, webSocket, {
|
||||
debug: this.debug,
|
||||
stompVersions: this.stompVersions,
|
||||
connectHeaders: this.connectHeaders,
|
||||
disconnectHeaders: this._disconnectHeaders,
|
||||
heartbeatIncoming: this.heartbeatIncoming,
|
||||
heartbeatOutgoing: this.heartbeatOutgoing,
|
||||
splitLargeFrames: this.splitLargeFrames,
|
||||
maxWebSocketChunkSize: this.maxWebSocketChunkSize,
|
||||
forceBinaryWSFrames: this.forceBinaryWSFrames,
|
||||
logRawCommunication: this.logRawCommunication,
|
||||
appendMissingNULLonIncoming: this.appendMissingNULLonIncoming,
|
||||
discardWebsocketOnCommFailure: this.discardWebsocketOnCommFailure,
|
||||
onConnect: frame => {
|
||||
// Successfully connected, stop the connection watcher
|
||||
if (this._connectionWatcher) {
|
||||
clearTimeout(this._connectionWatcher);
|
||||
this._connectionWatcher = undefined;
|
||||
}
|
||||
if (!this.active) {
|
||||
this.debug('STOMP got connected while deactivate was issued, will disconnect now');
|
||||
this._disposeStompHandler();
|
||||
return;
|
||||
}
|
||||
this.onConnect(frame);
|
||||
},
|
||||
onDisconnect: frame => {
|
||||
this.onDisconnect(frame);
|
||||
},
|
||||
onStompError: frame => {
|
||||
this.onStompError(frame);
|
||||
},
|
||||
onWebSocketClose: evt => {
|
||||
this._stompHandler = undefined; // a new one will be created in case of a reconnect
|
||||
if (this.state === ActivationState.DEACTIVATING) {
|
||||
// Mark deactivation complete
|
||||
this._resolveSocketClose();
|
||||
this._resolveSocketClose = undefined;
|
||||
this._changeState(ActivationState.INACTIVE);
|
||||
}
|
||||
this.onWebSocketClose(evt);
|
||||
// The callback is called before attempting to reconnect, this would allow the client
|
||||
// to be `deactivated` in the callback.
|
||||
if (this.active) {
|
||||
this._schedule_reconnect();
|
||||
}
|
||||
},
|
||||
onWebSocketError: evt => {
|
||||
this.onWebSocketError(evt);
|
||||
},
|
||||
onUnhandledMessage: message => {
|
||||
this.onUnhandledMessage(message);
|
||||
},
|
||||
onUnhandledReceipt: frame => {
|
||||
this.onUnhandledReceipt(frame);
|
||||
},
|
||||
onUnhandledFrame: frame => {
|
||||
this.onUnhandledFrame(frame);
|
||||
},
|
||||
});
|
||||
this._stompHandler.start();
|
||||
});
|
||||
}
|
||||
_createWebSocket() {
|
||||
let webSocket;
|
||||
if (this.webSocketFactory) {
|
||||
webSocket = this.webSocketFactory();
|
||||
}
|
||||
else {
|
||||
webSocket = new WebSocket(this.brokerURL, this.stompVersions.protocolVersions());
|
||||
}
|
||||
webSocket.binaryType = 'arraybuffer';
|
||||
return webSocket;
|
||||
}
|
||||
_schedule_reconnect() {
|
||||
if (this.reconnectDelay > 0) {
|
||||
this.debug(`STOMP: scheduling reconnection in ${this.reconnectDelay}ms`);
|
||||
this._reconnector = setTimeout(() => {
|
||||
this._connect();
|
||||
}, this.reconnectDelay);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Disconnect if connected and stop auto reconnect loop.
|
||||
* Appropriate callbacks will be invoked if underlying STOMP connection was connected.
|
||||
*
|
||||
* This call is async, it will resolve immediately if there is no underlying active websocket,
|
||||
* otherwise, it will resolve after underlying websocket is properly disposed.
|
||||
*
|
||||
* To reactivate you can call [Client#activate]{@link Client#activate}.
|
||||
*/
|
||||
deactivate() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let retPromise;
|
||||
if (this.state !== ActivationState.ACTIVE) {
|
||||
this.debug(`Already ${ActivationState[this.state]}, ignoring call to deactivate`);
|
||||
return Promise.resolve();
|
||||
}
|
||||
this._changeState(ActivationState.DEACTIVATING);
|
||||
// Clear if a reconnection was scheduled
|
||||
if (this._reconnector) {
|
||||
clearTimeout(this._reconnector);
|
||||
}
|
||||
if (this._stompHandler &&
|
||||
this.webSocket.readyState !== StompSocketState.CLOSED) {
|
||||
// we need to wait for underlying websocket to close
|
||||
retPromise = new Promise((resolve, reject) => {
|
||||
this._resolveSocketClose = resolve;
|
||||
});
|
||||
}
|
||||
else {
|
||||
// indicate that auto reconnect loop should terminate
|
||||
this._changeState(ActivationState.INACTIVE);
|
||||
return Promise.resolve();
|
||||
}
|
||||
this._disposeStompHandler();
|
||||
return retPromise;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Force disconnect if there is an active connection by directly closing the underlying WebSocket.
|
||||
* This is different than a normal disconnect where a DISCONNECT sequence is carried out with the broker.
|
||||
* After forcing disconnect, automatic reconnect will be attempted.
|
||||
* To stop further reconnects call [Client#deactivate]{@link Client#deactivate} as well.
|
||||
*/
|
||||
forceDisconnect() {
|
||||
if (this._stompHandler) {
|
||||
this._stompHandler.forceDisconnect();
|
||||
}
|
||||
}
|
||||
_disposeStompHandler() {
|
||||
// Dispose STOMP Handler
|
||||
if (this._stompHandler) {
|
||||
this._stompHandler.dispose();
|
||||
this._stompHandler = null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Send a message to a named destination. Refer to your STOMP broker documentation for types
|
||||
* and naming of destinations.
|
||||
*
|
||||
* STOMP protocol specifies and suggests some headers and also allows broker specific headers.
|
||||
*
|
||||
* `body` must be String.
|
||||
* You will need to covert the payload to string in case it is not string (e.g. JSON).
|
||||
*
|
||||
* To send a binary message body use binaryBody parameter. It should be a
|
||||
* [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).
|
||||
* Sometimes brokers may not support binary frames out of the box.
|
||||
* Please check your broker documentation.
|
||||
*
|
||||
* `content-length` header is automatically added to the STOMP Frame sent to the broker.
|
||||
* Set `skipContentLengthHeader` to indicate that `content-length` header should not be added.
|
||||
* For binary messages `content-length` header is always added.
|
||||
*
|
||||
* Caution: The broker will, most likely, report an error and disconnect if message body has NULL octet(s)
|
||||
* and `content-length` header is missing.
|
||||
*
|
||||
* ```javascript
|
||||
* client.publish({destination: "/queue/test", headers: {priority: 9}, body: "Hello, STOMP"});
|
||||
*
|
||||
* // Only destination is mandatory parameter
|
||||
* client.publish({destination: "/queue/test", body: "Hello, STOMP"});
|
||||
*
|
||||
* // Skip content-length header in the frame to the broker
|
||||
* client.publish({"/queue/test", body: "Hello, STOMP", skipContentLengthHeader: true});
|
||||
*
|
||||
* var binaryData = generateBinaryData(); // This need to be of type Uint8Array
|
||||
* // setting content-type header is not mandatory, however a good practice
|
||||
* client.publish({destination: '/topic/special', binaryBody: binaryData,
|
||||
* headers: {'content-type': 'application/octet-stream'}});
|
||||
* ```
|
||||
*/
|
||||
publish(params) {
|
||||
this._stompHandler.publish(params);
|
||||
}
|
||||
/**
|
||||
* STOMP brokers may carry out operation asynchronously and allow requesting for acknowledgement.
|
||||
* To request an acknowledgement, a `receipt` header needs to be sent with the actual request.
|
||||
* The value (say receipt-id) for this header needs to be unique for each use. Typically a sequence, a UUID, a
|
||||
* random number or a combination may be used.
|
||||
*
|
||||
* A complaint broker will send a RECEIPT frame when an operation has actually been completed.
|
||||
* The operation needs to be matched based in the value of the receipt-id.
|
||||
*
|
||||
* This method allow watching for a receipt and invoke the callback
|
||||
* when corresponding receipt has been received.
|
||||
*
|
||||
* The actual {@link FrameImpl} will be passed as parameter to the callback.
|
||||
*
|
||||
* Example:
|
||||
* ```javascript
|
||||
* // Subscribing with acknowledgement
|
||||
* let receiptId = randomText();
|
||||
*
|
||||
* client.watchForReceipt(receiptId, function() {
|
||||
* // Will be called after server acknowledges
|
||||
* });
|
||||
*
|
||||
* client.subscribe(TEST.destination, onMessage, {receipt: receiptId});
|
||||
*
|
||||
*
|
||||
* // Publishing with acknowledgement
|
||||
* receiptId = randomText();
|
||||
*
|
||||
* client.watchForReceipt(receiptId, function() {
|
||||
* // Will be called after server acknowledges
|
||||
* });
|
||||
* client.publish({destination: TEST.destination, headers: {receipt: receiptId}, body: msg});
|
||||
* ```
|
||||
*/
|
||||
watchForReceipt(receiptId, callback) {
|
||||
this._stompHandler.watchForReceipt(receiptId, callback);
|
||||
}
|
||||
/**
|
||||
* Subscribe to a STOMP Broker location. The callback will be invoked for each received message with
|
||||
* the {@link IMessage} as argument.
|
||||
*
|
||||
* Note: The library will generate an unique ID if there is none provided in the headers.
|
||||
* To use your own ID, pass it using the headers argument.
|
||||
*
|
||||
* ```javascript
|
||||
* callback = function(message) {
|
||||
* // called when the client receives a STOMP message from the server
|
||||
* if (message.body) {
|
||||
* alert("got message with body " + message.body)
|
||||
* } else {
|
||||
* alert("got empty message");
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* var subscription = client.subscribe("/queue/test", callback);
|
||||
*
|
||||
* // Explicit subscription id
|
||||
* var mySubId = 'my-subscription-id-001';
|
||||
* var subscription = client.subscribe(destination, callback, { id: mySubId });
|
||||
* ```
|
||||
*/
|
||||
subscribe(destination, callback, headers = {}) {
|
||||
return this._stompHandler.subscribe(destination, callback, headers);
|
||||
}
|
||||
/**
|
||||
* It is preferable to unsubscribe from a subscription by calling
|
||||
* `unsubscribe()` directly on {@link StompSubscription} returned by `client.subscribe()`:
|
||||
*
|
||||
* ```javascript
|
||||
* var subscription = client.subscribe(destination, onmessage);
|
||||
* // ...
|
||||
* subscription.unsubscribe();
|
||||
* ```
|
||||
*
|
||||
* See: http://stomp.github.com/stomp-specification-1.2.html#UNSUBSCRIBE UNSUBSCRIBE Frame
|
||||
*/
|
||||
unsubscribe(id, headers = {}) {
|
||||
this._stompHandler.unsubscribe(id, headers);
|
||||
}
|
||||
/**
|
||||
* Start a transaction, the returned {@link ITransaction} has methods - [commit]{@link ITransaction#commit}
|
||||
* and [abort]{@link ITransaction#abort}.
|
||||
*
|
||||
* `transactionId` is optional, if not passed the library will generate it internally.
|
||||
*/
|
||||
begin(transactionId) {
|
||||
return this._stompHandler.begin(transactionId);
|
||||
}
|
||||
/**
|
||||
* Commit a transaction.
|
||||
*
|
||||
* It is preferable to commit a transaction by calling [commit]{@link ITransaction#commit} directly on
|
||||
* {@link ITransaction} returned by [client.begin]{@link Client#begin}.
|
||||
*
|
||||
* ```javascript
|
||||
* var tx = client.begin(txId);
|
||||
* //...
|
||||
* tx.commit();
|
||||
* ```
|
||||
*/
|
||||
commit(transactionId) {
|
||||
this._stompHandler.commit(transactionId);
|
||||
}
|
||||
/**
|
||||
* Abort a transaction.
|
||||
* It is preferable to abort a transaction by calling [abort]{@link ITransaction#abort} directly on
|
||||
* {@link ITransaction} returned by [client.begin]{@link Client#begin}.
|
||||
*
|
||||
* ```javascript
|
||||
* var tx = client.begin(txId);
|
||||
* //...
|
||||
* tx.abort();
|
||||
* ```
|
||||
*/
|
||||
abort(transactionId) {
|
||||
this._stompHandler.abort(transactionId);
|
||||
}
|
||||
/**
|
||||
* ACK a message. It is preferable to acknowledge a message by calling [ack]{@link IMessage#ack} directly
|
||||
* on the {@link IMessage} handled by a subscription callback:
|
||||
*
|
||||
* ```javascript
|
||||
* var callback = function (message) {
|
||||
* // process the message
|
||||
* // acknowledge it
|
||||
* message.ack();
|
||||
* };
|
||||
* client.subscribe(destination, callback, {'ack': 'client'});
|
||||
* ```
|
||||
*/
|
||||
ack(messageId, subscriptionId, headers = {}) {
|
||||
this._stompHandler.ack(messageId, subscriptionId, headers);
|
||||
}
|
||||
/**
|
||||
* NACK a message. It is preferable to acknowledge a message by calling [nack]{@link IMessage#nack} directly
|
||||
* on the {@link IMessage} handled by a subscription callback:
|
||||
*
|
||||
* ```javascript
|
||||
* var callback = function (message) {
|
||||
* // process the message
|
||||
* // an error occurs, nack it
|
||||
* message.nack();
|
||||
* };
|
||||
* client.subscribe(destination, callback, {'ack': 'client'});
|
||||
* ```
|
||||
*/
|
||||
nack(messageId, subscriptionId, headers = {}) {
|
||||
this._stompHandler.nack(messageId, subscriptionId, headers);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=client.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/client.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/client.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
149
node_modules/@stomp/stompjs/esm6/compatibility/compat-client.d.ts
generated
vendored
Normal file
149
node_modules/@stomp/stompjs/esm6/compatibility/compat-client.d.ts
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
import { Client } from '../client';
|
||||
import { StompHeaders } from '../stomp-headers';
|
||||
import { frameCallbackType, messageCallbackType } from '../types';
|
||||
/**
|
||||
* Available for backward compatibility, please shift to using {@link Client}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)
|
||||
*/
|
||||
export declare class CompatClient extends Client {
|
||||
/**
|
||||
* It is no op now. No longer needed. Large packets work out of the box.
|
||||
*/
|
||||
maxWebSocketFrameSize: number;
|
||||
/**
|
||||
* Available for backward compatibility, please shift to using {@link Client}
|
||||
* and [Client#webSocketFactory]{@link Client#webSocketFactory}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
constructor(webSocketFactory: () => any);
|
||||
private _parseConnect;
|
||||
/**
|
||||
* Available for backward compatibility, please shift to using [Client#activate]{@link Client#activate}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
* The `connect` method accepts different number of arguments and types. See the Overloads list. Use the
|
||||
* version with headers to pass your broker specific options.
|
||||
*
|
||||
* overloads:
|
||||
* - connect(headers, connectCallback)
|
||||
* - connect(headers, connectCallback, errorCallback)
|
||||
* - connect(login, passcode, connectCallback)
|
||||
* - connect(login, passcode, connectCallback, errorCallback)
|
||||
* - connect(login, passcode, connectCallback, errorCallback, closeEventCallback)
|
||||
* - connect(login, passcode, connectCallback, errorCallback, closeEventCallback, host)
|
||||
*
|
||||
* params:
|
||||
* - headers, see [Client#connectHeaders]{@link Client#connectHeaders}
|
||||
* - connectCallback, see [Client#onConnect]{@link Client#onConnect}
|
||||
* - errorCallback, see [Client#onStompError]{@link Client#onStompError}
|
||||
* - closeEventCallback, see [Client#onWebSocketClose]{@link Client#onWebSocketClose}
|
||||
* - login [String], see [Client#connectHeaders](../classes/Client.html#connectHeaders)
|
||||
* - passcode [String], [Client#connectHeaders](../classes/Client.html#connectHeaders)
|
||||
* - host [String], see [Client#connectHeaders](../classes/Client.html#connectHeaders)
|
||||
*
|
||||
* To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)
|
||||
*/
|
||||
connect(...args: any[]): void;
|
||||
/**
|
||||
* Available for backward compatibility, please shift to using [Client#deactivate]{@link Client#deactivate}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
* See:
|
||||
* [Client#onDisconnect]{@link Client#onDisconnect}, and
|
||||
* [Client#disconnectHeaders]{@link Client#disconnectHeaders}
|
||||
*
|
||||
* To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)
|
||||
*/
|
||||
disconnect(disconnectCallback?: any, headers?: StompHeaders): void;
|
||||
/**
|
||||
* Available for backward compatibility, use [Client#publish]{@link Client#publish}.
|
||||
*
|
||||
* Send a message to a named destination. Refer to your STOMP broker documentation for types
|
||||
* and naming of destinations. The headers will, typically, be available to the subscriber.
|
||||
* However, there may be special purpose headers corresponding to your STOMP broker.
|
||||
*
|
||||
* **Deprecated**, use [Client#publish]{@link Client#publish}
|
||||
*
|
||||
* Note: Body must be String. You will need to covert the payload to string in case it is not string (e.g. JSON)
|
||||
*
|
||||
* ```javascript
|
||||
* client.send("/queue/test", {priority: 9}, "Hello, STOMP");
|
||||
*
|
||||
* // If you want to send a message with a body, you must also pass the headers argument.
|
||||
* client.send("/queue/test", {}, "Hello, STOMP");
|
||||
* ```
|
||||
*
|
||||
* To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)
|
||||
*/
|
||||
send(destination: string, headers?: {
|
||||
[key: string]: any;
|
||||
}, body?: string): void;
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#reconnectDelay]{@link Client#reconnectDelay}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
reconnect_delay: number;
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#webSocket]{@link Client#webSocket}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
readonly ws: any;
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#connectedVersion]{@link Client#connectedVersion}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
readonly version: string;
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
onreceive: messageCallbackType;
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#onUnhandledReceipt]{@link Client#onUnhandledReceipt}.
|
||||
* Prefer using [Client#watchForReceipt]{@link Client#watchForReceipt}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#onUnhandledReceipt]{@link Client#onUnhandledReceipt}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
onreceipt: frameCallbackType;
|
||||
private _heartbeatInfo;
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#heartbeatIncoming]{@link Client#heartbeatIncoming}
|
||||
* [Client#heartbeatOutgoing]{@link Client#heartbeatOutgoing}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#heartbeatIncoming]{@link Client#heartbeatIncoming}
|
||||
* [Client#heartbeatOutgoing]{@link Client#heartbeatOutgoing}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
heartbeat: {
|
||||
incoming: number;
|
||||
outgoing: number;
|
||||
};
|
||||
}
|
||||
241
node_modules/@stomp/stompjs/esm6/compatibility/compat-client.js
generated
vendored
Normal file
241
node_modules/@stomp/stompjs/esm6/compatibility/compat-client.js
generated
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
import { Client } from '../client';
|
||||
import { HeartbeatInfo } from './heartbeat-info';
|
||||
/**
|
||||
* Available for backward compatibility, please shift to using {@link Client}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)
|
||||
*/
|
||||
export class CompatClient extends Client {
|
||||
/**
|
||||
* Available for backward compatibility, please shift to using {@link Client}
|
||||
* and [Client#webSocketFactory]{@link Client#webSocketFactory}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
constructor(webSocketFactory) {
|
||||
super();
|
||||
/**
|
||||
* It is no op now. No longer needed. Large packets work out of the box.
|
||||
*/
|
||||
this.maxWebSocketFrameSize = 16 * 1024;
|
||||
this._heartbeatInfo = new HeartbeatInfo(this);
|
||||
this.reconnect_delay = 0;
|
||||
this.webSocketFactory = webSocketFactory;
|
||||
// Default from previous version
|
||||
this.debug = (...message) => {
|
||||
console.log(...message);
|
||||
};
|
||||
}
|
||||
_parseConnect(...args) {
|
||||
let closeEventCallback;
|
||||
let connectCallback;
|
||||
let errorCallback;
|
||||
let headers = {};
|
||||
if (args.length < 2) {
|
||||
throw new Error('Connect requires at least 2 arguments');
|
||||
}
|
||||
if (typeof args[1] === 'function') {
|
||||
[headers, connectCallback, errorCallback, closeEventCallback] = args;
|
||||
}
|
||||
else {
|
||||
switch (args.length) {
|
||||
case 6:
|
||||
[
|
||||
headers.login,
|
||||
headers.passcode,
|
||||
connectCallback,
|
||||
errorCallback,
|
||||
closeEventCallback,
|
||||
headers.host,
|
||||
] = args;
|
||||
break;
|
||||
default:
|
||||
[
|
||||
headers.login,
|
||||
headers.passcode,
|
||||
connectCallback,
|
||||
errorCallback,
|
||||
closeEventCallback,
|
||||
] = args;
|
||||
}
|
||||
}
|
||||
return [headers, connectCallback, errorCallback, closeEventCallback];
|
||||
}
|
||||
/**
|
||||
* Available for backward compatibility, please shift to using [Client#activate]{@link Client#activate}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
* The `connect` method accepts different number of arguments and types. See the Overloads list. Use the
|
||||
* version with headers to pass your broker specific options.
|
||||
*
|
||||
* overloads:
|
||||
* - connect(headers, connectCallback)
|
||||
* - connect(headers, connectCallback, errorCallback)
|
||||
* - connect(login, passcode, connectCallback)
|
||||
* - connect(login, passcode, connectCallback, errorCallback)
|
||||
* - connect(login, passcode, connectCallback, errorCallback, closeEventCallback)
|
||||
* - connect(login, passcode, connectCallback, errorCallback, closeEventCallback, host)
|
||||
*
|
||||
* params:
|
||||
* - headers, see [Client#connectHeaders]{@link Client#connectHeaders}
|
||||
* - connectCallback, see [Client#onConnect]{@link Client#onConnect}
|
||||
* - errorCallback, see [Client#onStompError]{@link Client#onStompError}
|
||||
* - closeEventCallback, see [Client#onWebSocketClose]{@link Client#onWebSocketClose}
|
||||
* - login [String], see [Client#connectHeaders](../classes/Client.html#connectHeaders)
|
||||
* - passcode [String], [Client#connectHeaders](../classes/Client.html#connectHeaders)
|
||||
* - host [String], see [Client#connectHeaders](../classes/Client.html#connectHeaders)
|
||||
*
|
||||
* To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)
|
||||
*/
|
||||
connect(...args) {
|
||||
const out = this._parseConnect(...args);
|
||||
if (out[0]) {
|
||||
this.connectHeaders = out[0];
|
||||
}
|
||||
if (out[1]) {
|
||||
this.onConnect = out[1];
|
||||
}
|
||||
if (out[2]) {
|
||||
this.onStompError = out[2];
|
||||
}
|
||||
if (out[3]) {
|
||||
this.onWebSocketClose = out[3];
|
||||
}
|
||||
super.activate();
|
||||
}
|
||||
/**
|
||||
* Available for backward compatibility, please shift to using [Client#deactivate]{@link Client#deactivate}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
* See:
|
||||
* [Client#onDisconnect]{@link Client#onDisconnect}, and
|
||||
* [Client#disconnectHeaders]{@link Client#disconnectHeaders}
|
||||
*
|
||||
* To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)
|
||||
*/
|
||||
disconnect(disconnectCallback, headers = {}) {
|
||||
if (disconnectCallback) {
|
||||
this.onDisconnect = disconnectCallback;
|
||||
}
|
||||
this.disconnectHeaders = headers;
|
||||
super.deactivate();
|
||||
}
|
||||
/**
|
||||
* Available for backward compatibility, use [Client#publish]{@link Client#publish}.
|
||||
*
|
||||
* Send a message to a named destination. Refer to your STOMP broker documentation for types
|
||||
* and naming of destinations. The headers will, typically, be available to the subscriber.
|
||||
* However, there may be special purpose headers corresponding to your STOMP broker.
|
||||
*
|
||||
* **Deprecated**, use [Client#publish]{@link Client#publish}
|
||||
*
|
||||
* Note: Body must be String. You will need to covert the payload to string in case it is not string (e.g. JSON)
|
||||
*
|
||||
* ```javascript
|
||||
* client.send("/queue/test", {priority: 9}, "Hello, STOMP");
|
||||
*
|
||||
* // If you want to send a message with a body, you must also pass the headers argument.
|
||||
* client.send("/queue/test", {}, "Hello, STOMP");
|
||||
* ```
|
||||
*
|
||||
* To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)
|
||||
*/
|
||||
send(destination, headers = {}, body = '') {
|
||||
headers = Object.assign({}, headers);
|
||||
const skipContentLengthHeader = headers['content-length'] === false;
|
||||
if (skipContentLengthHeader) {
|
||||
delete headers['content-length'];
|
||||
}
|
||||
this.publish({
|
||||
destination,
|
||||
headers: headers,
|
||||
body,
|
||||
skipContentLengthHeader,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#reconnectDelay]{@link Client#reconnectDelay}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
set reconnect_delay(value) {
|
||||
this.reconnectDelay = value;
|
||||
}
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#webSocket]{@link Client#webSocket}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
get ws() {
|
||||
return this.webSocket;
|
||||
}
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#connectedVersion]{@link Client#connectedVersion}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
get version() {
|
||||
return this.connectedVersion;
|
||||
}
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
get onreceive() {
|
||||
return this.onUnhandledMessage;
|
||||
}
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
set onreceive(value) {
|
||||
this.onUnhandledMessage = value;
|
||||
}
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#onUnhandledReceipt]{@link Client#onUnhandledReceipt}.
|
||||
* Prefer using [Client#watchForReceipt]{@link Client#watchForReceipt}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
get onreceipt() {
|
||||
return this.onUnhandledReceipt;
|
||||
}
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#onUnhandledReceipt]{@link Client#onUnhandledReceipt}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
set onreceipt(value) {
|
||||
this.onUnhandledReceipt = value;
|
||||
}
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#heartbeatIncoming]{@link Client#heartbeatIncoming}
|
||||
* [Client#heartbeatOutgoing]{@link Client#heartbeatOutgoing}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
get heartbeat() {
|
||||
return this._heartbeatInfo;
|
||||
}
|
||||
/**
|
||||
* Available for backward compatibility, renamed to [Client#heartbeatIncoming]{@link Client#heartbeatIncoming}
|
||||
* [Client#heartbeatOutgoing]{@link Client#heartbeatOutgoing}.
|
||||
*
|
||||
* **Deprecated**
|
||||
*/
|
||||
set heartbeat(value) {
|
||||
this.heartbeatIncoming = value.incoming;
|
||||
this.heartbeatOutgoing = value.outgoing;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=compat-client.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/compatibility/compat-client.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/compatibility/compat-client.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"compat-client.js","sourceRoot":"","sources":["../../src/compatibility/compat-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;;;;;GAQG;AACH,MAAM,OAAO,YAAa,SAAQ,MAAM;IAMtC;;;;;;;OAOG;IACH,YAAY,gBAA2B;QACrC,KAAK,EAAE,CAAC;QAdV;;WAEG;QACI,0BAAqB,GAAW,EAAE,GAAG,IAAI,CAAC;QAoOzC,mBAAc,GAAkB,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;QAxN9D,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,gCAAgC;QAChC,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,OAAc,EAAE,EAAE;YACjC,OAAO,CAAC,GAAG,CAAC,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H,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACH,IAAI,SAAS,CAAC,KAA0B;QACtC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IAClC,CAAC;IAED;;;;;OAKG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACH,IAAI,SAAS,CAAC,KAAwB;QACpC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IAClC,CAAC;IAID;;;;;OAKG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACH,IAAI,SAAS,CAAC,KAA6C;QACzD,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAAC;QACxC,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAAC;IAC1C,CAAC;CACF"}
|
||||
12
node_modules/@stomp/stompjs/esm6/compatibility/heartbeat-info.d.ts
generated
vendored
Normal file
12
node_modules/@stomp/stompjs/esm6/compatibility/heartbeat-info.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { CompatClient } from './compat-client';
|
||||
/**
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export declare class HeartbeatInfo {
|
||||
private client;
|
||||
constructor(client: CompatClient);
|
||||
outgoing: number;
|
||||
incoming: number;
|
||||
}
|
||||
23
node_modules/@stomp/stompjs/esm6/compatibility/heartbeat-info.js
generated
vendored
Normal file
23
node_modules/@stomp/stompjs/esm6/compatibility/heartbeat-info.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export class HeartbeatInfo {
|
||||
constructor(client) {
|
||||
this.client = client;
|
||||
}
|
||||
get outgoing() {
|
||||
return this.client.heartbeatOutgoing;
|
||||
}
|
||||
set outgoing(value) {
|
||||
this.client.heartbeatOutgoing = value;
|
||||
}
|
||||
get incoming() {
|
||||
return this.client.heartbeatIncoming;
|
||||
}
|
||||
set incoming(value) {
|
||||
this.client.heartbeatIncoming = value;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=heartbeat-info.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/compatibility/heartbeat-info.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/compatibility/heartbeat-info.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"heartbeat-info.js","sourceRoot":"","sources":["../../src/compatibility/heartbeat-info.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,aAAa;IACxB,YAAoB,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAE5C,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC;IACvC,CAAC;IAED,IAAI,QAAQ,CAAC,KAAa;QACxB,IAAI,CAAC,MAAM,CAAC,iBAAiB,GAAG,KAAK,CAAC;IACxC,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC;IACvC,CAAC;IAED,IAAI,QAAQ,CAAC,KAAa;QACxB,IAAI,CAAC,MAAM,CAAC,iBAAiB,GAAG,KAAK,CAAC;IACxC,CAAC;CACF"}
|
||||
67
node_modules/@stomp/stompjs/esm6/compatibility/stomp.d.ts
generated
vendored
Normal file
67
node_modules/@stomp/stompjs/esm6/compatibility/stomp.d.ts
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
import { CompatClient } from './compat-client';
|
||||
/**
|
||||
* STOMP Class, acts like a factory to create {@link Client}.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
* It will be removed in next major version. Please switch to {@link Client}.
|
||||
*/
|
||||
export declare class Stomp {
|
||||
/**
|
||||
* In case you need to use a non standard class for WebSocket.
|
||||
*
|
||||
* For example when using within NodeJS environment:
|
||||
*
|
||||
* ```javascript
|
||||
* StompJs = require('../../esm5/');
|
||||
* Stomp = StompJs.Stomp;
|
||||
* Stomp.WebSocketClass = require('websocket').w3cwebsocket;
|
||||
* ```
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
*
|
||||
* It will be removed in next major version. Please switch to {@link Client}
|
||||
* using [Client#webSocketFactory]{@link Client#webSocketFactory}.
|
||||
*/
|
||||
static WebSocketClass: any;
|
||||
/**
|
||||
* This method creates a WebSocket client that is connected to
|
||||
* the STOMP server located at the url.
|
||||
*
|
||||
* ```javascript
|
||||
* var url = "ws://localhost:61614/stomp";
|
||||
* var client = Stomp.client(url);
|
||||
* ```
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
* It will be removed in next major version. Please switch to {@link Client}
|
||||
* using [Client#brokerURL]{@link Client#brokerURL}.
|
||||
*/
|
||||
static client(url: string, protocols?: string[]): CompatClient;
|
||||
/**
|
||||
* This method is an alternative to [Stomp#client]{@link Stomp#client} to let the user
|
||||
* specify the WebSocket to use (either a standard HTML5 WebSocket or
|
||||
* a similar object).
|
||||
*
|
||||
* In order to support reconnection, the function Client._connect should be callable more than once.
|
||||
* While reconnecting
|
||||
* a new instance of underlying transport (TCP Socket, WebSocket or SockJS) will be needed. So, this function
|
||||
* alternatively allows passing a function that should return a new instance of the underlying socket.
|
||||
*
|
||||
* ```javascript
|
||||
* var client = Stomp.over(function(){
|
||||
* return new WebSocket('ws://localhost:15674/ws')
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
* It will be removed in next major version. Please switch to {@link Client}
|
||||
* using [Client#webSocketFactory]{@link Client#webSocketFactory}.
|
||||
*/
|
||||
static over(ws: any): CompatClient;
|
||||
}
|
||||
102
node_modules/@stomp/stompjs/esm6/compatibility/stomp.js
generated
vendored
Normal file
102
node_modules/@stomp/stompjs/esm6/compatibility/stomp.js
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
import { Versions } from '../versions';
|
||||
import { CompatClient } from './compat-client';
|
||||
/**
|
||||
* STOMP Class, acts like a factory to create {@link Client}.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
* It will be removed in next major version. Please switch to {@link Client}.
|
||||
*/
|
||||
export class Stomp {
|
||||
/**
|
||||
* This method creates a WebSocket client that is connected to
|
||||
* the STOMP server located at the url.
|
||||
*
|
||||
* ```javascript
|
||||
* var url = "ws://localhost:61614/stomp";
|
||||
* var client = Stomp.client(url);
|
||||
* ```
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
* It will be removed in next major version. Please switch to {@link Client}
|
||||
* using [Client#brokerURL]{@link Client#brokerURL}.
|
||||
*/
|
||||
static client(url, protocols) {
|
||||
// This is a hack to allow another implementation than the standard
|
||||
// HTML5 WebSocket class.
|
||||
//
|
||||
// It is possible to use another class by calling
|
||||
//
|
||||
// Stomp.WebSocketClass = MozWebSocket
|
||||
//
|
||||
// *prior* to call `Stomp.client()`.
|
||||
//
|
||||
// This hack is deprecated and `Stomp.over()` method should be used
|
||||
// instead.
|
||||
// See remarks on the function Stomp.over
|
||||
if (protocols == null) {
|
||||
protocols = Versions.default.protocolVersions();
|
||||
}
|
||||
const wsFn = () => {
|
||||
const klass = Stomp.WebSocketClass || WebSocket;
|
||||
return new klass(url, protocols);
|
||||
};
|
||||
return new CompatClient(wsFn);
|
||||
}
|
||||
/**
|
||||
* This method is an alternative to [Stomp#client]{@link Stomp#client} to let the user
|
||||
* specify the WebSocket to use (either a standard HTML5 WebSocket or
|
||||
* a similar object).
|
||||
*
|
||||
* In order to support reconnection, the function Client._connect should be callable more than once.
|
||||
* While reconnecting
|
||||
* a new instance of underlying transport (TCP Socket, WebSocket or SockJS) will be needed. So, this function
|
||||
* alternatively allows passing a function that should return a new instance of the underlying socket.
|
||||
*
|
||||
* ```javascript
|
||||
* var client = Stomp.over(function(){
|
||||
* return new WebSocket('ws://localhost:15674/ws')
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
* It will be removed in next major version. Please switch to {@link Client}
|
||||
* using [Client#webSocketFactory]{@link Client#webSocketFactory}.
|
||||
*/
|
||||
static over(ws) {
|
||||
let wsFn;
|
||||
if (typeof ws === 'function') {
|
||||
wsFn = ws;
|
||||
}
|
||||
else {
|
||||
console.warn('Stomp.over did not receive a factory, auto reconnect will not work. ' +
|
||||
'Please see https://stomp-js.github.io/api-docs/latest/classes/Stomp.html#over');
|
||||
wsFn = () => ws;
|
||||
}
|
||||
return new CompatClient(wsFn);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* In case you need to use a non standard class for WebSocket.
|
||||
*
|
||||
* For example when using within NodeJS environment:
|
||||
*
|
||||
* ```javascript
|
||||
* StompJs = require('../../esm5/');
|
||||
* Stomp = StompJs.Stomp;
|
||||
* Stomp.WebSocketClass = require('websocket').w3cwebsocket;
|
||||
* ```
|
||||
*
|
||||
* **Deprecated**
|
||||
*
|
||||
*
|
||||
* It will be removed in next major version. Please switch to {@link Client}
|
||||
* using [Client#webSocketFactory]{@link Client#webSocketFactory}.
|
||||
*/
|
||||
// tslint:disable-next-line:variable-name
|
||||
Stomp.WebSocketClass = null;
|
||||
//# sourceMappingURL=stomp.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/compatibility/stomp.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/compatibility/stomp.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"stomp.js","sourceRoot":"","sources":["../../src/compatibility/stomp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAW/C;;;;;;;;GAQG;AACH,MAAM,OAAO,KAAK;IAqBhB;;;;;;;;;;;;;OAaG;IACI,MAAM,CAAC,MAAM,CAAC,GAAW,EAAE,SAAoB;QACpD,mEAAmE;QACnE,yBAAyB;QACzB,EAAE;QACF,iDAAiD;QACjD,EAAE;QACF,0CAA0C;QAC1C,EAAE;QACF,oCAAoC;QACpC,EAAE;QACF,mEAAmE;QACnE,WAAW;QAEX,yCAAyC;QACzC,IAAI,SAAS,IAAI,IAAI,EAAE;YACrB,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;SACjD;QACD,MAAM,IAAI,GAAG,GAAG,EAAE;YAChB,MAAM,KAAK,GAAG,KAAK,CAAC,cAAc,IAAI,SAAS,CAAC;YAChD,OAAO,IAAI,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QACnC,CAAC,CAAC;QAEF,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACI,MAAM,CAAC,IAAI,CAAC,EAAO;QACxB,IAAI,IAAe,CAAC;QAEpB,IAAI,OAAO,EAAE,KAAK,UAAU,EAAE;YAC5B,IAAI,GAAG,EAAE,CAAC;SACX;aAAM;YACL,OAAO,CAAC,IAAI,CACV,sEAAsE;gBACpE,+EAA+E,CAClF,CAAC;YACF,IAAI,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC;SACjB;QAED,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;;AA9FD;;;;;;;;;;;;;;;;GAgBG;AACH,yCAAyC;AAC3B,oBAAc,GAAQ,IAAI,CAAC"}
|
||||
95
node_modules/@stomp/stompjs/esm6/frame-impl.d.ts
generated
vendored
Normal file
95
node_modules/@stomp/stompjs/esm6/frame-impl.d.ts
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
import { IFrame } from './i-frame';
|
||||
import { StompHeaders } from './stomp-headers';
|
||||
import { IRawFrameType } from './types';
|
||||
/**
|
||||
* Frame class represents a STOMP frame.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export declare class FrameImpl implements IFrame {
|
||||
/**
|
||||
* STOMP Command
|
||||
*/
|
||||
command: string;
|
||||
/**
|
||||
* Headers, key value pairs.
|
||||
*/
|
||||
headers: StompHeaders;
|
||||
/**
|
||||
* Is this frame binary (based on whether body/binaryBody was passed when creating this frame).
|
||||
*/
|
||||
isBinaryBody: boolean;
|
||||
/**
|
||||
* body of the frame
|
||||
*/
|
||||
readonly body: string;
|
||||
private _body;
|
||||
/**
|
||||
* body as Uint8Array
|
||||
*/
|
||||
readonly binaryBody: Uint8Array;
|
||||
private _binaryBody;
|
||||
private escapeHeaderValues;
|
||||
private skipContentLengthHeader;
|
||||
/**
|
||||
* Frame constructor. `command`, `headers` and `body` are available as properties.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
constructor(params: {
|
||||
command: string;
|
||||
headers?: StompHeaders;
|
||||
body?: string;
|
||||
binaryBody?: Uint8Array;
|
||||
escapeHeaderValues?: boolean;
|
||||
skipContentLengthHeader?: boolean;
|
||||
});
|
||||
/**
|
||||
* deserialize a STOMP Frame from raw data.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
static fromRawFrame(rawFrame: IRawFrameType, escapeHeaderValues: boolean): FrameImpl;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
toString(): string;
|
||||
/**
|
||||
* serialize this Frame in a format suitable to be passed to WebSocket.
|
||||
* If the body is string the output will be string.
|
||||
* If the body is binary (i.e. of type Unit8Array) it will be serialized to ArrayBuffer.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
serialize(): string | ArrayBuffer;
|
||||
private serializeCmdAndHeaders;
|
||||
private isBodyEmpty;
|
||||
private bodyLength;
|
||||
/**
|
||||
* Compute the size of a UTF-8 string by counting its number of bytes
|
||||
* (and not the number of characters composing the string)
|
||||
*/
|
||||
private static sizeOfUTF8;
|
||||
private static toUnit8Array;
|
||||
/**
|
||||
* Serialize a STOMP frame as per STOMP standards, suitable to be sent to the STOMP broker.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
static marshall(params: {
|
||||
command: string;
|
||||
headers?: StompHeaders;
|
||||
body?: string;
|
||||
binaryBody?: Uint8Array;
|
||||
escapeHeaderValues?: boolean;
|
||||
skipContentLengthHeader?: boolean;
|
||||
}): string | ArrayBuffer;
|
||||
/**
|
||||
* Escape header values
|
||||
*/
|
||||
private static hdrValueEscape;
|
||||
/**
|
||||
* UnEscape header values
|
||||
*/
|
||||
private static hdrValueUnEscape;
|
||||
}
|
||||
170
node_modules/@stomp/stompjs/esm6/frame-impl.js
generated
vendored
Normal file
170
node_modules/@stomp/stompjs/esm6/frame-impl.js
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
import { BYTE } from './byte';
|
||||
/**
|
||||
* Frame class represents a STOMP frame.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export class FrameImpl {
|
||||
/**
|
||||
* Frame constructor. `command`, `headers` and `body` are available as properties.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
constructor(params) {
|
||||
const { command, headers, body, binaryBody, escapeHeaderValues, skipContentLengthHeader, } = params;
|
||||
this.command = command;
|
||||
this.headers = Object.assign({}, headers || {});
|
||||
if (binaryBody) {
|
||||
this._binaryBody = binaryBody;
|
||||
this.isBinaryBody = true;
|
||||
}
|
||||
else {
|
||||
this._body = body || '';
|
||||
this.isBinaryBody = false;
|
||||
}
|
||||
this.escapeHeaderValues = escapeHeaderValues || false;
|
||||
this.skipContentLengthHeader = skipContentLengthHeader || false;
|
||||
}
|
||||
/**
|
||||
* body of the frame
|
||||
*/
|
||||
get body() {
|
||||
if (!this._body && this.isBinaryBody) {
|
||||
this._body = new TextDecoder().decode(this._binaryBody);
|
||||
}
|
||||
return this._body;
|
||||
}
|
||||
/**
|
||||
* body as Uint8Array
|
||||
*/
|
||||
get binaryBody() {
|
||||
if (!this._binaryBody && !this.isBinaryBody) {
|
||||
this._binaryBody = new TextEncoder().encode(this._body);
|
||||
}
|
||||
return this._binaryBody;
|
||||
}
|
||||
/**
|
||||
* deserialize a STOMP Frame from raw data.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
static fromRawFrame(rawFrame, escapeHeaderValues) {
|
||||
const headers = {};
|
||||
const trim = (str) => str.replace(/^\s+|\s+$/g, '');
|
||||
// In case of repeated headers, as per standards, first value need to be used
|
||||
for (const header of rawFrame.headers.reverse()) {
|
||||
const idx = header.indexOf(':');
|
||||
const key = trim(header[0]);
|
||||
let value = trim(header[1]);
|
||||
if (escapeHeaderValues &&
|
||||
rawFrame.command !== 'CONNECT' &&
|
||||
rawFrame.command !== 'CONNECTED') {
|
||||
value = FrameImpl.hdrValueUnEscape(value);
|
||||
}
|
||||
headers[key] = value;
|
||||
}
|
||||
return new FrameImpl({
|
||||
command: rawFrame.command,
|
||||
headers,
|
||||
binaryBody: rawFrame.binaryBody,
|
||||
escapeHeaderValues,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
toString() {
|
||||
return this.serializeCmdAndHeaders();
|
||||
}
|
||||
/**
|
||||
* serialize this Frame in a format suitable to be passed to WebSocket.
|
||||
* If the body is string the output will be string.
|
||||
* If the body is binary (i.e. of type Unit8Array) it will be serialized to ArrayBuffer.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
serialize() {
|
||||
const cmdAndHeaders = this.serializeCmdAndHeaders();
|
||||
if (this.isBinaryBody) {
|
||||
return FrameImpl.toUnit8Array(cmdAndHeaders, this._binaryBody).buffer;
|
||||
}
|
||||
else {
|
||||
return cmdAndHeaders + this._body + BYTE.NULL;
|
||||
}
|
||||
}
|
||||
serializeCmdAndHeaders() {
|
||||
const lines = [this.command];
|
||||
if (this.skipContentLengthHeader) {
|
||||
delete this.headers['content-length'];
|
||||
}
|
||||
for (const name of Object.keys(this.headers || {})) {
|
||||
const value = this.headers[name];
|
||||
if (this.escapeHeaderValues &&
|
||||
this.command !== 'CONNECT' &&
|
||||
this.command !== 'CONNECTED') {
|
||||
lines.push(`${name}:${FrameImpl.hdrValueEscape(`${value}`)}`);
|
||||
}
|
||||
else {
|
||||
lines.push(`${name}:${value}`);
|
||||
}
|
||||
}
|
||||
if (this.isBinaryBody ||
|
||||
(!this.isBodyEmpty() && !this.skipContentLengthHeader)) {
|
||||
lines.push(`content-length:${this.bodyLength()}`);
|
||||
}
|
||||
return lines.join(BYTE.LF) + BYTE.LF + BYTE.LF;
|
||||
}
|
||||
isBodyEmpty() {
|
||||
return this.bodyLength() === 0;
|
||||
}
|
||||
bodyLength() {
|
||||
const binaryBody = this.binaryBody;
|
||||
return binaryBody ? binaryBody.length : 0;
|
||||
}
|
||||
/**
|
||||
* Compute the size of a UTF-8 string by counting its number of bytes
|
||||
* (and not the number of characters composing the string)
|
||||
*/
|
||||
static sizeOfUTF8(s) {
|
||||
return s ? new TextEncoder().encode(s).length : 0;
|
||||
}
|
||||
static toUnit8Array(cmdAndHeaders, binaryBody) {
|
||||
const uint8CmdAndHeaders = new TextEncoder().encode(cmdAndHeaders);
|
||||
const nullTerminator = new Uint8Array([0]);
|
||||
const uint8Frame = new Uint8Array(uint8CmdAndHeaders.length + binaryBody.length + nullTerminator.length);
|
||||
uint8Frame.set(uint8CmdAndHeaders);
|
||||
uint8Frame.set(binaryBody, uint8CmdAndHeaders.length);
|
||||
uint8Frame.set(nullTerminator, uint8CmdAndHeaders.length + binaryBody.length);
|
||||
return uint8Frame;
|
||||
}
|
||||
/**
|
||||
* Serialize a STOMP frame as per STOMP standards, suitable to be sent to the STOMP broker.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
static marshall(params) {
|
||||
const frame = new FrameImpl(params);
|
||||
return frame.serialize();
|
||||
}
|
||||
/**
|
||||
* Escape header values
|
||||
*/
|
||||
static hdrValueEscape(str) {
|
||||
return str
|
||||
.replace(/\\/g, '\\\\')
|
||||
.replace(/\r/g, '\\r')
|
||||
.replace(/\n/g, '\\n')
|
||||
.replace(/:/g, '\\c');
|
||||
}
|
||||
/**
|
||||
* UnEscape header values
|
||||
*/
|
||||
static hdrValueUnEscape(str) {
|
||||
return str
|
||||
.replace(/\\r/g, '\r')
|
||||
.replace(/\\n/g, '\n')
|
||||
.replace(/\\c/g, ':')
|
||||
.replace(/\\\\/g, '\\');
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=frame-impl.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/frame-impl.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/frame-impl.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"frame-impl.js","sourceRoot":"","sources":["../src/frame-impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAK9B;;;;GAIG;AACH,MAAM,OAAO,SAAS;IAyCpB;;;;OAIG;IACH,YAAY,MAOX;QACC,MAAM,EACJ,OAAO,EACP,OAAO,EACP,IAAI,EACJ,UAAU,EACV,kBAAkB,EAClB,uBAAuB,GACxB,GAAG,MAAM,CAAC;QACX,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAI,MAAc,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;QAEzD,IAAI,UAAU,EAAE;YACd,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;SAC1B;aAAM;YACL,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;SAC3B;QACD,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,IAAI,KAAK,CAAC;QACtD,IAAI,CAAC,uBAAuB,GAAG,uBAAuB,IAAI,KAAK,CAAC;IAClE,CAAC;IA1DD;;OAEG;IACH,IAAI,IAAI;QACN,IAAI,CAAC,IAAI,CAAC,K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AC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,MAOtB;QACC,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,KAAK,CAAC,SAAS,EAAE,CAAC;IAC3B,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,cAAc,CAAC,GAAW;QACvC,OAAO,GAAG;aACP,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;aACtB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;aACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;aACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,gBAAgB,CAAC,GAAW;QACzC,OAAO,GAAG;aACP,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;aACrB,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC;aACrB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;aACpB,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC;CACF"}
|
||||
35
node_modules/@stomp/stompjs/esm6/i-frame.d.ts
generated
vendored
Normal file
35
node_modules/@stomp/stompjs/esm6/i-frame.d.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import { StompHeaders } from './stomp-headers';
|
||||
/**
|
||||
* It represents a STOMP frame. Many of the callbacks pass an IFrame received from
|
||||
* the STOMP broker. For advanced usage you might need to access [headers]{@link IFrame#headers}.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* {@link IMessage} is an extended IFrame.
|
||||
*/
|
||||
export interface IFrame {
|
||||
/**
|
||||
* STOMP Command
|
||||
*/
|
||||
command: string;
|
||||
/**
|
||||
* Headers, key value pairs.
|
||||
*/
|
||||
headers: StompHeaders;
|
||||
/**
|
||||
* Is this frame binary (based on whether body/binaryBody was passed when creating this frame).
|
||||
*/
|
||||
isBinaryBody: boolean;
|
||||
/**
|
||||
* body of the frame as string
|
||||
*/
|
||||
readonly body: string;
|
||||
/**
|
||||
* body as Uint8Array
|
||||
*/
|
||||
readonly binaryBody: Uint8Array;
|
||||
}
|
||||
/**
|
||||
* Alias for {@link IFrame}
|
||||
*/
|
||||
export declare type Frame = IFrame;
|
||||
1
node_modules/@stomp/stompjs/esm6/i-frame.js
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/i-frame.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
//# sourceMappingURL=i-frame.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/i-frame.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/i-frame.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"i-frame.js","sourceRoot":"","sources":["../src/i-frame.ts"],"names":[],"mappings":""}
|
||||
32
node_modules/@stomp/stompjs/esm6/i-message.d.ts
generated
vendored
Normal file
32
node_modules/@stomp/stompjs/esm6/i-message.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { IFrame } from './i-frame';
|
||||
import { StompHeaders } from './stomp-headers';
|
||||
/**
|
||||
* Instance of Message will be passed to [subscription callback]{@link Client#subscribe}
|
||||
* and [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}.
|
||||
* Since it is an extended {@link FrameImpl}, you can access [headers]{@link FrameImpl#headers}
|
||||
* and [body]{@link FrameImpl#body} as properties.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* See [Client#subscribe]{@link Client#subscribe} for example.
|
||||
*/
|
||||
export interface IMessage extends IFrame {
|
||||
/**
|
||||
* When subscribing with manual acknowledgement, call this method on the message to ACK the message.
|
||||
*
|
||||
* See [Client#ack]{@link Client#ack} for an example.
|
||||
*/
|
||||
ack: (headers?: StompHeaders) => void;
|
||||
/**
|
||||
* When subscribing with manual acknowledgement, call this method on the message to NACK the message.
|
||||
*
|
||||
* See [Client#nack]{@link Client#nack} for an example.
|
||||
*/
|
||||
nack: (headers?: StompHeaders) => void;
|
||||
}
|
||||
/**
|
||||
* Aliased to {@link IMessage}.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export declare type Message = IMessage;
|
||||
1
node_modules/@stomp/stompjs/esm6/i-message.js
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/i-message.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
//# sourceMappingURL=i-message.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/i-message.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/i-message.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"i-message.js","sourceRoot":"","sources":["../src/i-message.ts"],"names":[],"mappings":""}
|
||||
21
node_modules/@stomp/stompjs/esm6/i-transaction.d.ts
generated
vendored
Normal file
21
node_modules/@stomp/stompjs/esm6/i-transaction.d.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* A Transaction is created by calling [Client#begin]{@link Client#begin}
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* TODO: Example and caveat
|
||||
*/
|
||||
export interface ITransaction {
|
||||
/**
|
||||
* You will need to access this to send, ack, or nack within this transaction.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Commit this transaction. See [Client#commit]{@link Client#commit} for an example.
|
||||
*/
|
||||
commit: () => void;
|
||||
/**
|
||||
* Abort this transaction. See [Client#abort]{@link Client#abort} for an example.
|
||||
*/
|
||||
abort: () => void;
|
||||
}
|
||||
1
node_modules/@stomp/stompjs/esm6/i-transaction.js
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/i-transaction.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
//# sourceMappingURL=i-transaction.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/i-transaction.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/i-transaction.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"i-transaction.js","sourceRoot":"","sources":["../src/i-transaction.ts"],"names":[],"mappings":""}
|
||||
13
node_modules/@stomp/stompjs/esm6/index.d.ts
generated
vendored
Normal file
13
node_modules/@stomp/stompjs/esm6/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
export * from './client';
|
||||
export * from './frame-impl';
|
||||
export * from './i-frame';
|
||||
export * from './i-message';
|
||||
export * from './parser';
|
||||
export * from './stomp-config';
|
||||
export * from './stomp-headers';
|
||||
export * from './stomp-subscription';
|
||||
export * from './i-transaction';
|
||||
export * from './types';
|
||||
export * from './versions';
|
||||
export * from './compatibility/compat-client';
|
||||
export * from './compatibility/stomp';
|
||||
12
node_modules/@stomp/stompjs/esm6/index.js
generated
vendored
Normal file
12
node_modules/@stomp/stompjs/esm6/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export * from './client';
|
||||
export * from './frame-impl';
|
||||
export * from './parser';
|
||||
export * from './stomp-config';
|
||||
export * from './stomp-headers';
|
||||
export * from './stomp-subscription';
|
||||
export * from './types';
|
||||
export * from './versions';
|
||||
// Compatibility code
|
||||
export * from './compatibility/compat-client';
|
||||
export * from './compatibility/stomp';
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/index.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAG7B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AAErC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAE3B,qBAAqB;AACrB,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC"}
|
||||
70
node_modules/@stomp/stompjs/esm6/parser.d.ts
generated
vendored
Normal file
70
node_modules/@stomp/stompjs/esm6/parser.d.ts
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
import { IRawFrameType } from './types';
|
||||
/**
|
||||
* This is an evented, rec descent parser.
|
||||
* A stream of Octets can be passed and whenever it recognizes
|
||||
* a complete Frame or an incoming ping it will invoke the registered callbacks.
|
||||
*
|
||||
* All incoming Octets are fed into _onByte function.
|
||||
* Depending on current state the _onByte function keeps changing.
|
||||
* Depending on the state it keeps accumulating into _token and _results.
|
||||
* State is indicated by current value of _onByte, all states are named as _collect.
|
||||
*
|
||||
* STOMP standards https://stomp.github.io/stomp-specification-1.2.html
|
||||
* imply that all lengths are considered in bytes (instead of string lengths).
|
||||
* So, before actual parsing, if the incoming data is String it is converted to Octets.
|
||||
* This allows faithful implementation of the protocol and allows NULL Octets to be present in the body.
|
||||
*
|
||||
* There is no peek function on the incoming data.
|
||||
* When a state change occurs based on an Octet without consuming the Octet,
|
||||
* the Octet, after state change, is fed again (_reinjectByte).
|
||||
* This became possible as the state change can be determined by inspecting just one Octet.
|
||||
*
|
||||
* There are two modes to collect the body, if content-length header is there then it by counting Octets
|
||||
* otherwise it is determined by NULL terminator.
|
||||
*
|
||||
* Following the standards, the command and headers are converted to Strings
|
||||
* and the body is returned as Octets.
|
||||
* Headers are returned as an array and not as Hash - to allow multiple occurrence of an header.
|
||||
*
|
||||
* This parser does not use Regular Expressions as that can only operate on Strings.
|
||||
*
|
||||
* It handles if multiple STOMP frames are given as one chunk, a frame is split into multiple chunks, or
|
||||
* any combination there of. The parser remembers its state (any partial frame) and continues when a new chunk
|
||||
* is pushed.
|
||||
*
|
||||
* Typically the higher level function will convert headers to Hash, handle unescaping of header values
|
||||
* (which is protocol version specific), and convert body to text.
|
||||
*
|
||||
* Check the parser.spec.js to understand cases that this parser is supposed to handle.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export declare class Parser {
|
||||
onFrame: (rawFrame: IRawFrameType) => void;
|
||||
onIncomingPing: () => void;
|
||||
private readonly _encoder;
|
||||
private readonly _decoder;
|
||||
private _results;
|
||||
private _token;
|
||||
private _headerKey;
|
||||
private _bodyBytesRemaining;
|
||||
private _onByte;
|
||||
constructor(onFrame: (rawFrame: IRawFrameType) => void, onIncomingPing: () => void);
|
||||
parseChunk(segment: string | ArrayBuffer, appendMissingNULLonIncoming?: boolean): void;
|
||||
private _collectFrame;
|
||||
private _collectCommand;
|
||||
private _collectHeaders;
|
||||
private _reinjectByte;
|
||||
private _collectHeaderKey;
|
||||
private _collectHeaderValue;
|
||||
private _setupCollectBody;
|
||||
private _collectBodyNullTerminated;
|
||||
private _collectBodyFixedSize;
|
||||
private _retrievedBody;
|
||||
private _consumeByte;
|
||||
private _consumeTokenAsUTF8;
|
||||
private _consumeTokenAsRaw;
|
||||
private _initState;
|
||||
}
|
||||
214
node_modules/@stomp/stompjs/esm6/parser.js
generated
vendored
Normal file
214
node_modules/@stomp/stompjs/esm6/parser.js
generated
vendored
Normal file
@@ -0,0 +1,214 @@
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const NULL = 0;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const LF = 10;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const CR = 13;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
const COLON = 58;
|
||||
/**
|
||||
* This is an evented, rec descent parser.
|
||||
* A stream of Octets can be passed and whenever it recognizes
|
||||
* a complete Frame or an incoming ping it will invoke the registered callbacks.
|
||||
*
|
||||
* All incoming Octets are fed into _onByte function.
|
||||
* Depending on current state the _onByte function keeps changing.
|
||||
* Depending on the state it keeps accumulating into _token and _results.
|
||||
* State is indicated by current value of _onByte, all states are named as _collect.
|
||||
*
|
||||
* STOMP standards https://stomp.github.io/stomp-specification-1.2.html
|
||||
* imply that all lengths are considered in bytes (instead of string lengths).
|
||||
* So, before actual parsing, if the incoming data is String it is converted to Octets.
|
||||
* This allows faithful implementation of the protocol and allows NULL Octets to be present in the body.
|
||||
*
|
||||
* There is no peek function on the incoming data.
|
||||
* When a state change occurs based on an Octet without consuming the Octet,
|
||||
* the Octet, after state change, is fed again (_reinjectByte).
|
||||
* This became possible as the state change can be determined by inspecting just one Octet.
|
||||
*
|
||||
* There are two modes to collect the body, if content-length header is there then it by counting Octets
|
||||
* otherwise it is determined by NULL terminator.
|
||||
*
|
||||
* Following the standards, the command and headers are converted to Strings
|
||||
* and the body is returned as Octets.
|
||||
* Headers are returned as an array and not as Hash - to allow multiple occurrence of an header.
|
||||
*
|
||||
* This parser does not use Regular Expressions as that can only operate on Strings.
|
||||
*
|
||||
* It handles if multiple STOMP frames are given as one chunk, a frame is split into multiple chunks, or
|
||||
* any combination there of. The parser remembers its state (any partial frame) and continues when a new chunk
|
||||
* is pushed.
|
||||
*
|
||||
* Typically the higher level function will convert headers to Hash, handle unescaping of header values
|
||||
* (which is protocol version specific), and convert body to text.
|
||||
*
|
||||
* Check the parser.spec.js to understand cases that this parser is supposed to handle.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export class Parser {
|
||||
constructor(onFrame, onIncomingPing) {
|
||||
this.onFrame = onFrame;
|
||||
this.onIncomingPing = onIncomingPing;
|
||||
this._encoder = new TextEncoder();
|
||||
this._decoder = new TextDecoder();
|
||||
this._token = [];
|
||||
this._initState();
|
||||
}
|
||||
parseChunk(segment, appendMissingNULLonIncoming = false) {
|
||||
let chunk;
|
||||
if (segment instanceof ArrayBuffer) {
|
||||
chunk = new Uint8Array(segment);
|
||||
}
|
||||
else {
|
||||
chunk = this._encoder.encode(segment);
|
||||
}
|
||||
// See https://github.com/stomp-js/stompjs/issues/89
|
||||
// Remove when underlying issue is fixed.
|
||||
//
|
||||
// Send a NULL byte, if the last byte of a Text frame was not NULL.F
|
||||
if (appendMissingNULLonIncoming && chunk[chunk.length - 1] !== 0) {
|
||||
const chunkWithNull = new Uint8Array(chunk.length + 1);
|
||||
chunkWithNull.set(chunk, 0);
|
||||
chunkWithNull[chunk.length] = 0;
|
||||
chunk = chunkWithNull;
|
||||
}
|
||||
// tslint:disable-next-line:prefer-for-of
|
||||
for (let i = 0; i < chunk.length; i++) {
|
||||
const byte = chunk[i];
|
||||
this._onByte(byte);
|
||||
}
|
||||
}
|
||||
// The following implements a simple Rec Descent Parser.
|
||||
// The grammar is simple and just one byte tells what should be the next state
|
||||
_collectFrame(byte) {
|
||||
if (byte === NULL) {
|
||||
// Ignore
|
||||
return;
|
||||
}
|
||||
if (byte === CR) {
|
||||
// Ignore CR
|
||||
return;
|
||||
}
|
||||
if (byte === LF) {
|
||||
// Incoming Ping
|
||||
this.onIncomingPing();
|
||||
return;
|
||||
}
|
||||
this._onByte = this._collectCommand;
|
||||
this._reinjectByte(byte);
|
||||
}
|
||||
_collectCommand(byte) {
|
||||
if (byte === CR) {
|
||||
// Ignore CR
|
||||
return;
|
||||
}
|
||||
if (byte === LF) {
|
||||
this._results.command = this._consumeTokenAsUTF8();
|
||||
this._onByte = this._collectHeaders;
|
||||
return;
|
||||
}
|
||||
this._consumeByte(byte);
|
||||
}
|
||||
_collectHeaders(byte) {
|
||||
if (byte === CR) {
|
||||
// Ignore CR
|
||||
return;
|
||||
}
|
||||
if (byte === LF) {
|
||||
this._setupCollectBody();
|
||||
return;
|
||||
}
|
||||
this._onByte = this._collectHeaderKey;
|
||||
this._reinjectByte(byte);
|
||||
}
|
||||
_reinjectByte(byte) {
|
||||
this._onByte(byte);
|
||||
}
|
||||
_collectHeaderKey(byte) {
|
||||
if (byte === COLON) {
|
||||
this._headerKey = this._consumeTokenAsUTF8();
|
||||
this._onByte = this._collectHeaderValue;
|
||||
return;
|
||||
}
|
||||
this._consumeByte(byte);
|
||||
}
|
||||
_collectHeaderValue(byte) {
|
||||
if (byte === CR) {
|
||||
// Ignore CR
|
||||
return;
|
||||
}
|
||||
if (byte === LF) {
|
||||
this._results.headers.push([this._headerKey, this._consumeTokenAsUTF8()]);
|
||||
this._headerKey = undefined;
|
||||
this._onByte = this._collectHeaders;
|
||||
return;
|
||||
}
|
||||
this._consumeByte(byte);
|
||||
}
|
||||
_setupCollectBody() {
|
||||
const contentLengthHeader = this._results.headers.filter((header) => {
|
||||
return header[0] === 'content-length';
|
||||
})[0];
|
||||
if (contentLengthHeader) {
|
||||
this._bodyBytesRemaining = parseInt(contentLengthHeader[1], 10);
|
||||
this._onByte = this._collectBodyFixedSize;
|
||||
}
|
||||
else {
|
||||
this._onByte = this._collectBodyNullTerminated;
|
||||
}
|
||||
}
|
||||
_collectBodyNullTerminated(byte) {
|
||||
if (byte === NULL) {
|
||||
this._retrievedBody();
|
||||
return;
|
||||
}
|
||||
this._consumeByte(byte);
|
||||
}
|
||||
_collectBodyFixedSize(byte) {
|
||||
// It is post decrement, so that we discard the trailing NULL octet
|
||||
if (this._bodyBytesRemaining-- === 0) {
|
||||
this._retrievedBody();
|
||||
return;
|
||||
}
|
||||
this._consumeByte(byte);
|
||||
}
|
||||
_retrievedBody() {
|
||||
this._results.binaryBody = this._consumeTokenAsRaw();
|
||||
this.onFrame(this._results);
|
||||
this._initState();
|
||||
}
|
||||
// Rec Descent Parser helpers
|
||||
_consumeByte(byte) {
|
||||
this._token.push(byte);
|
||||
}
|
||||
_consumeTokenAsUTF8() {
|
||||
return this._decoder.decode(this._consumeTokenAsRaw());
|
||||
}
|
||||
_consumeTokenAsRaw() {
|
||||
const rawResult = new Uint8Array(this._token);
|
||||
this._token = [];
|
||||
return rawResult;
|
||||
}
|
||||
_initState() {
|
||||
this._results = {
|
||||
command: undefined,
|
||||
headers: [],
|
||||
binaryBody: undefined,
|
||||
};
|
||||
this._token = [];
|
||||
this._headerKey = undefined;
|
||||
this._onByte = this._collectFrame;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=parser.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/parser.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/parser.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,IAAI,GAAG,CAAC,CAAC;AACf;;GAEG;AACH,MAAM,EAAE,GAAG,EAAE,CAAC;AACd;;GAEG;AACH,MAAM,EAAE,GAAG,EAAE,CAAC;AACd;;GAEG;AACH,MAAM,KAAK,GAAG,EAAE,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAM,OAAO,MAAM;IAYjB,YACS,OAA0C,EAC1C,cAA0B;QAD1B,YAAO,GAAP,OAAO,CAAmC;QAC1C,mBAAc,GAAd,cAAc,CAAY;QAblB,aAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;QAC7B,aAAQ,GAAG,IAAI,WAAW,EAAE,CAAC;QAItC,WAAM,GAAa,EAAE,CAAC;QAU5B,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAEM,UAAU,CACf,OAA6B,EAC7B,8BAAuC,KAAK;QAE5C,IAAI,KAAiB,CAAC;QAEtB,IAAI,OAAO,YAAY,WAAW,EAAE;YAClC,KAAK,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;SACjC;aAAM;YACL,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;SACvC;QAED,oDAAoD;QACpD,yCAAyC;QACzC,EAAE;QACF,oEAAoE;QACpE,IAAI,2BAA2B,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE;YAChE,MAAM,aAAa,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CA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SAAS;YAClB,OAAO,EAAE,EAAE;YACX,UAAU,EAAE,SAAS;SACtB,CAAC;QAEF,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAE5B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC;IACpC,CAAC;CACF"}
|
||||
119
node_modules/@stomp/stompjs/esm6/stomp-config.d.ts
generated
vendored
Normal file
119
node_modules/@stomp/stompjs/esm6/stomp-config.d.ts
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
import { StompHeaders } from './stomp-headers';
|
||||
import { ActivationState, closeEventCallbackType, debugFnType, frameCallbackType, messageCallbackType, wsErrorCallbackType } from './types';
|
||||
import { Versions } from './versions';
|
||||
/**
|
||||
* Configuration options for STOMP Client, each key corresponds to
|
||||
* field by the same name in {@link Client}. This can be passed to
|
||||
* the constructor of {@link Client} or to [Client#configure]{@link Client#configure}.
|
||||
*
|
||||
* There used to be a class with the same name in `@stomp/ng2-stompjs`, which has been replaced by
|
||||
* {@link RxStompConfig} and {@link InjectableRxStompConfig}.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export declare class StompConfig {
|
||||
/**
|
||||
* See [Client#brokerURL]{@link Client#brokerURL}.
|
||||
*/
|
||||
brokerURL?: string;
|
||||
/**
|
||||
* See See [Client#stompVersions]{@link Client#stompVersions}.
|
||||
*/
|
||||
stompVersions?: Versions;
|
||||
/**
|
||||
* See [Client#webSocketFactory]{@link Client#webSocketFactory}.
|
||||
*/
|
||||
webSocketFactory?: () => any;
|
||||
/**
|
||||
* See [Client#connectionTimeout]{@link Client#connectionTimeout}.
|
||||
*/
|
||||
connectionTimeout?: number;
|
||||
/**
|
||||
* See [Client#reconnectDelay]{@link Client#reconnectDelay}.
|
||||
*/
|
||||
reconnectDelay?: number;
|
||||
/**
|
||||
* See [Client#heartbeatIncoming]{@link Client#heartbeatIncoming}.
|
||||
*/
|
||||
heartbeatIncoming?: number;
|
||||
/**
|
||||
* See [Client#heartbeatOutgoing]{@link Client#heartbeatOutgoing}.
|
||||
*/
|
||||
heartbeatOutgoing?: number;
|
||||
/**
|
||||
* See [Client#splitLargeFrames]{@link Client#splitLargeFrames}.
|
||||
*/
|
||||
splitLargeFrames?: boolean;
|
||||
/**
|
||||
* See [Client#forceBinaryWSFrames]{@link Client#forceBinaryWSFrames}.
|
||||
*/
|
||||
forceBinaryWSFrames?: boolean;
|
||||
/**
|
||||
* See [Client#appendMissingNULLonIncoming]{@link Client#appendMissingNULLonIncoming}.
|
||||
*/
|
||||
appendMissingNULLonIncoming?: boolean;
|
||||
/**
|
||||
* See [Client#maxWebSocketChunkSize]{@link Client#maxWebSocketChunkSize}.
|
||||
*/
|
||||
maxWebSocketChunkSize?: number;
|
||||
/**
|
||||
* See [Client#connectHeaders]{@link Client#connectHeaders}.
|
||||
*/
|
||||
connectHeaders?: StompHeaders;
|
||||
/**
|
||||
* See [Client#disconnectHeaders]{@link Client#disconnectHeaders}.
|
||||
*/
|
||||
disconnectHeaders?: StompHeaders;
|
||||
/**
|
||||
* See [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}.
|
||||
*/
|
||||
onUnhandledMessage?: messageCallbackType;
|
||||
/**
|
||||
* See [Client#onUnhandledReceipt]{@link Client#onUnhandledReceipt}.
|
||||
*/
|
||||
onUnhandledReceipt?: frameCallbackType;
|
||||
/**
|
||||
* See [Client#onUnhandledFrame]{@link Client#onUnhandledFrame}.
|
||||
*/
|
||||
onUnhandledFrame?: frameCallbackType;
|
||||
/**
|
||||
* See [Client#beforeConnect]{@link Client#beforeConnect}.
|
||||
*/
|
||||
beforeConnect?: () => void | Promise<void>;
|
||||
/**
|
||||
* See [Client#onConnect]{@link Client#onConnect}.
|
||||
*/
|
||||
onConnect?: frameCallbackType;
|
||||
/**
|
||||
* See [Client#onDisconnect]{@link Client#onDisconnect}.
|
||||
*/
|
||||
onDisconnect?: frameCallbackType;
|
||||
/**
|
||||
* See [Client#onStompError]{@link Client#onStompError}.
|
||||
*/
|
||||
onStompError?: frameCallbackType;
|
||||
/**
|
||||
* See [Client#onWebSocketClose]{@link Client#onWebSocketClose}.
|
||||
*/
|
||||
onWebSocketClose?: closeEventCallbackType;
|
||||
/**
|
||||
* See [Client#onWebSocketError]{@link Client#onWebSocketError}.
|
||||
*/
|
||||
onWebSocketError?: wsErrorCallbackType;
|
||||
/**
|
||||
* See [Client#logRawCommunication]{@link Client#logRawCommunication}.
|
||||
*/
|
||||
logRawCommunication?: boolean;
|
||||
/**
|
||||
* See [Client#debug]{@link Client#debug}.
|
||||
*/
|
||||
debug?: debugFnType;
|
||||
/**
|
||||
* See [Client#discardWebsocketOnCommFailure]{@link Client#discardWebsocketOnCommFailure}.
|
||||
*/
|
||||
discardWebsocketOnCommFailure?: boolean;
|
||||
/**
|
||||
* See [Client#onChangeState]{@link Client#onChangeState}.
|
||||
*/
|
||||
onChangeState?: (state: ActivationState) => void;
|
||||
}
|
||||
13
node_modules/@stomp/stompjs/esm6/stomp-config.js
generated
vendored
Normal file
13
node_modules/@stomp/stompjs/esm6/stomp-config.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Configuration options for STOMP Client, each key corresponds to
|
||||
* field by the same name in {@link Client}. This can be passed to
|
||||
* the constructor of {@link Client} or to [Client#configure]{@link Client#configure}.
|
||||
*
|
||||
* There used to be a class with the same name in `@stomp/ng2-stompjs`, which has been replaced by
|
||||
* {@link RxStompConfig} and {@link InjectableRxStompConfig}.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export class StompConfig {
|
||||
}
|
||||
//# sourceMappingURL=stomp-config.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/stomp-config.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/stomp-config.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"stomp-config.js","sourceRoot":"","sources":["../src/stomp-config.ts"],"names":[],"mappings":"AAWA;;;;;;;;;GASG;AACH,MAAM,OAAO,WAAW;CAkIvB"}
|
||||
72
node_modules/@stomp/stompjs/esm6/stomp-handler.d.ts
generated
vendored
Normal file
72
node_modules/@stomp/stompjs/esm6/stomp-handler.d.ts
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
import { Client } from './client';
|
||||
import { ITransaction } from './i-transaction';
|
||||
import { StompConfig } from './stomp-config';
|
||||
import { StompHeaders } from './stomp-headers';
|
||||
import { StompSubscription } from './stomp-subscription';
|
||||
import { closeEventCallbackType, debugFnType, frameCallbackType, IPublishParams, IStompSocket, messageCallbackType, wsErrorCallbackType } from './types';
|
||||
import { Versions } from './versions';
|
||||
/**
|
||||
* The STOMP protocol handler
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export declare class StompHandler {
|
||||
private _client;
|
||||
_webSocket: IStompSocket;
|
||||
debug: debugFnType;
|
||||
stompVersions: Versions;
|
||||
connectHeaders: StompHeaders;
|
||||
disconnectHeaders: StompHeaders;
|
||||
heartbeatIncoming: number;
|
||||
heartbeatOutgoing: number;
|
||||
onUnhandledMessage: messageCallbackType;
|
||||
onUnhandledReceipt: frameCallbackType;
|
||||
onUnhandledFrame: frameCallbackType;
|
||||
onConnect: frameCallbackType;
|
||||
onDisconnect: frameCallbackType;
|
||||
onStompError: frameCallbackType;
|
||||
onWebSocketClose: closeEventCallbackType;
|
||||
onWebSocketError: wsErrorCallbackType;
|
||||
logRawCommunication: boolean;
|
||||
splitLargeFrames: boolean;
|
||||
maxWebSocketChunkSize: number;
|
||||
forceBinaryWSFrames: boolean;
|
||||
appendMissingNULLonIncoming: boolean;
|
||||
discardWebsocketOnCommFailure: boolean;
|
||||
readonly connectedVersion: string;
|
||||
private _connectedVersion;
|
||||
readonly connected: boolean;
|
||||
private _connected;
|
||||
private readonly _subscriptions;
|
||||
private readonly _receiptWatchers;
|
||||
private _partialData;
|
||||
private _escapeHeaderValues;
|
||||
private _counter;
|
||||
private _pinger;
|
||||
private _ponger;
|
||||
private _lastServerActivityTS;
|
||||
private _onclose;
|
||||
constructor(_client: Client, _webSocket: IStompSocket, config?: StompConfig);
|
||||
configure(conf: StompConfig): void;
|
||||
start(): void;
|
||||
private readonly _serverFrameHandlers;
|
||||
private _setupHeartbeat;
|
||||
private _closeOrDiscardWebsocket;
|
||||
forceDisconnect(): void;
|
||||
_closeWebsocket(): void;
|
||||
private _discardWebsocket;
|
||||
private _transmit;
|
||||
dispose(): void;
|
||||
private _cleanUp;
|
||||
publish(params: IPublishParams): void;
|
||||
watchForReceipt(receiptId: string, callback: frameCallbackType): void;
|
||||
subscribe(destination: string, callback: messageCallbackType, headers?: StompHeaders): StompSubscription;
|
||||
unsubscribe(id: string, headers?: StompHeaders): void;
|
||||
begin(transactionId: string): ITransaction;
|
||||
commit(transactionId: string): void;
|
||||
abort(transactionId: string): void;
|
||||
ack(messageId: string, subscriptionId: string, headers?: StompHeaders): void;
|
||||
nack(messageId: string, subscriptionId: string, headers?: StompHeaders): void;
|
||||
}
|
||||
373
node_modules/@stomp/stompjs/esm6/stomp-handler.js
generated
vendored
Normal file
373
node_modules/@stomp/stompjs/esm6/stomp-handler.js
generated
vendored
Normal file
@@ -0,0 +1,373 @@
|
||||
import { BYTE } from './byte';
|
||||
import { FrameImpl } from './frame-impl';
|
||||
import { Parser } from './parser';
|
||||
import { StompSocketState, } from './types';
|
||||
import { Versions } from './versions';
|
||||
import { augmentWebsocket } from './augment-websocket';
|
||||
/**
|
||||
* The STOMP protocol handler
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export class StompHandler {
|
||||
constructor(_client, _webSocket, config = {}) {
|
||||
this._client = _client;
|
||||
this._webSocket = _webSocket;
|
||||
this._serverFrameHandlers = {
|
||||
// [CONNECTED Frame](http://stomp.github.com/stomp-specification-1.2.html#CONNECTED_Frame)
|
||||
CONNECTED: frame => {
|
||||
this.debug(`connected to server ${frame.headers.server}`);
|
||||
this._connected = true;
|
||||
this._connectedVersion = frame.headers.version;
|
||||
// STOMP version 1.2 needs header values to be escaped
|
||||
if (this._connectedVersion === Versions.V1_2) {
|
||||
this._escapeHeaderValues = true;
|
||||
}
|
||||
this._setupHeartbeat(frame.headers);
|
||||
this.onConnect(frame);
|
||||
},
|
||||
// [MESSAGE Frame](http://stomp.github.com/stomp-specification-1.2.html#MESSAGE)
|
||||
MESSAGE: frame => {
|
||||
// the callback is registered when the client calls
|
||||
// `subscribe()`.
|
||||
// If there is no registered subscription for the received message,
|
||||
// the default `onUnhandledMessage` callback is used that the client can set.
|
||||
// This is useful for subscriptions that are automatically created
|
||||
// on the browser side (e.g. [RabbitMQ's temporary
|
||||
// queues](http://www.rabbitmq.com/stomp.html)).
|
||||
const subscription = frame.headers.subscription;
|
||||
const onReceive = this._subscriptions[subscription] || this.onUnhandledMessage;
|
||||
// bless the frame to be a Message
|
||||
const message = frame;
|
||||
const client = this;
|
||||
const messageId = this._connectedVersion === Versions.V1_2
|
||||
? message.headers.ack
|
||||
: message.headers['message-id'];
|
||||
// add `ack()` and `nack()` methods directly to the returned frame
|
||||
// so that a simple call to `message.ack()` can acknowledge the message.
|
||||
message.ack = (headers = {}) => {
|
||||
return client.ack(messageId, subscription, headers);
|
||||
};
|
||||
message.nack = (headers = {}) => {
|
||||
return client.nack(messageId, subscription, headers);
|
||||
};
|
||||
onReceive(message);
|
||||
},
|
||||
// [RECEIPT Frame](http://stomp.github.com/stomp-specification-1.2.html#RECEIPT)
|
||||
RECEIPT: frame => {
|
||||
const callback = this._receiptWatchers[frame.headers['receipt-id']];
|
||||
if (callback) {
|
||||
callback(frame);
|
||||
// Server will acknowledge only once, remove the callback
|
||||
delete this._receiptWatchers[frame.headers['receipt-id']];
|
||||
}
|
||||
else {
|
||||
this.onUnhandledReceipt(frame);
|
||||
}
|
||||
},
|
||||
// [ERROR Frame](http://stomp.github.com/stomp-specification-1.2.html#ERROR)
|
||||
ERROR: frame => {
|
||||
this.onStompError(frame);
|
||||
},
|
||||
};
|
||||
// used to index subscribers
|
||||
this._counter = 0;
|
||||
// subscription callbacks indexed by subscriber's ID
|
||||
this._subscriptions = {};
|
||||
// receipt-watchers indexed by receipts-ids
|
||||
this._receiptWatchers = {};
|
||||
this._partialData = '';
|
||||
this._escapeHeaderValues = false;
|
||||
this._lastServerActivityTS = Date.now();
|
||||
this.configure(config);
|
||||
}
|
||||
get connectedVersion() {
|
||||
return this._connectedVersion;
|
||||
}
|
||||
get connected() {
|
||||
return this._connected;
|
||||
}
|
||||
configure(conf) {
|
||||
// bulk assign all properties to this
|
||||
Object.assign(this, conf);
|
||||
}
|
||||
start() {
|
||||
const parser = new Parser(
|
||||
// On Frame
|
||||
rawFrame => {
|
||||
const frame = FrameImpl.fromRawFrame(rawFrame, this._escapeHeaderValues);
|
||||
// if this.logRawCommunication is set, the rawChunk is logged at this._webSocket.onmessage
|
||||
if (!this.logRawCommunication) {
|
||||
this.debug(`<<< ${frame}`);
|
||||
}
|
||||
const serverFrameHandler = this._serverFrameHandlers[frame.command] || this.onUnhandledFrame;
|
||||
serverFrameHandler(frame);
|
||||
},
|
||||
// On Incoming Ping
|
||||
() => {
|
||||
this.debug('<<< PONG');
|
||||
});
|
||||
this._webSocket.onmessage = (evt) => {
|
||||
this.debug('Received data');
|
||||
this._lastServerActivityTS = Date.now();
|
||||
if (this.logRawCommunication) {
|
||||
const rawChunkAsString = evt.data instanceof ArrayBuffer
|
||||
? new TextDecoder().decode(evt.data)
|
||||
: evt.data;
|
||||
this.debug(`<<< ${rawChunkAsString}`);
|
||||
}
|
||||
parser.parseChunk(evt.data, this.appendMissingNULLonIncoming);
|
||||
};
|
||||
this._onclose = (closeEvent) => {
|
||||
this.debug(`Connection closed to ${this._client.brokerURL}`);
|
||||
this._cleanUp();
|
||||
this.onWebSocketClose(closeEvent);
|
||||
};
|
||||
this._webSocket.onclose = this._onclose;
|
||||
this._webSocket.onerror = (errorEvent) => {
|
||||
this.onWebSocketError(errorEvent);
|
||||
};
|
||||
this._webSocket.onopen = () => {
|
||||
// Clone before updating
|
||||
const connectHeaders = Object.assign({}, this.connectHeaders);
|
||||
this.debug('Web Socket Opened...');
|
||||
connectHeaders['accept-version'] = this.stompVersions.supportedVersions();
|
||||
connectHeaders['heart-beat'] = [
|
||||
this.heartbeatOutgoing,
|
||||
this.heartbeatIncoming,
|
||||
].join(',');
|
||||
this._transmit({ command: 'CONNECT', headers: connectHeaders });
|
||||
};
|
||||
}
|
||||
_setupHeartbeat(headers) {
|
||||
if (headers.version !== Versions.V1_1 &&
|
||||
headers.version !== Versions.V1_2) {
|
||||
return;
|
||||
}
|
||||
// It is valid for the server to not send this header
|
||||
// https://stomp.github.io/stomp-specification-1.2.html#Heart-beating
|
||||
if (!headers['heart-beat']) {
|
||||
return;
|
||||
}
|
||||
// heart-beat header received from the server looks like:
|
||||
//
|
||||
// heart-beat: sx, sy
|
||||
const [serverOutgoing, serverIncoming] = headers['heart-beat']
|
||||
.split(',')
|
||||
.map((v) => parseInt(v, 10));
|
||||
if (this.heartbeatOutgoing !== 0 && serverIncoming !== 0) {
|
||||
const ttl = Math.max(this.heartbeatOutgoing, serverIncoming);
|
||||
this.debug(`send PING every ${ttl}ms`);
|
||||
this._pinger = setInterval(() => {
|
||||
if (this._webSocket.readyState === StompSocketState.OPEN) {
|
||||
this._webSocket.send(BYTE.LF);
|
||||
this.debug('>>> PING');
|
||||
}
|
||||
}, ttl);
|
||||
}
|
||||
if (this.heartbeatIncoming !== 0 && serverOutgoing !== 0) {
|
||||
const ttl = Math.max(this.heartbeatIncoming, serverOutgoing);
|
||||
this.debug(`check PONG every ${ttl}ms`);
|
||||
this._ponger = setInterval(() => {
|
||||
const delta = Date.now() - this._lastServerActivityTS;
|
||||
// We wait twice the TTL to be flexible on window's setInterval calls
|
||||
if (delta > ttl * 2) {
|
||||
this.debug(`did not receive server activity for the last ${delta}ms`);
|
||||
this._closeOrDiscardWebsocket();
|
||||
}
|
||||
}, ttl);
|
||||
}
|
||||
}
|
||||
_closeOrDiscardWebsocket() {
|
||||
if (this.discardWebsocketOnCommFailure) {
|
||||
this.debug('Discarding websocket, the underlying socket may linger for a while');
|
||||
this._discardWebsocket();
|
||||
}
|
||||
else {
|
||||
this.debug('Issuing close on the websocket');
|
||||
this._closeWebsocket();
|
||||
}
|
||||
}
|
||||
forceDisconnect() {
|
||||
if (this._webSocket) {
|
||||
if (this._webSocket.readyState === StompSocketState.CONNECTING ||
|
||||
this._webSocket.readyState === StompSocketState.OPEN) {
|
||||
this._closeOrDiscardWebsocket();
|
||||
}
|
||||
}
|
||||
}
|
||||
_closeWebsocket() {
|
||||
this._webSocket.onmessage = () => { }; // ignore messages
|
||||
this._webSocket.close();
|
||||
}
|
||||
_discardWebsocket() {
|
||||
if (!this._webSocket.terminate) {
|
||||
augmentWebsocket(this._webSocket, (msg) => this.debug(msg));
|
||||
}
|
||||
this._webSocket.terminate();
|
||||
}
|
||||
_transmit(params) {
|
||||
const { command, headers, body, binaryBody, skipContentLengthHeader } = params;
|
||||
const frame = new FrameImpl({
|
||||
command,
|
||||
headers,
|
||||
body,
|
||||
binaryBody,
|
||||
escapeHeaderValues: this._escapeHeaderValues,
|
||||
skipContentLengthHeader,
|
||||
});
|
||||
let rawChunk = frame.serialize();
|
||||
if (this.logRawCommunication) {
|
||||
this.debug(`>>> ${rawChunk}`);
|
||||
}
|
||||
else {
|
||||
this.debug(`>>> ${frame}`);
|
||||
}
|
||||
if (this.forceBinaryWSFrames && typeof rawChunk === 'string') {
|
||||
rawChunk = new TextEncoder().encode(rawChunk);
|
||||
}
|
||||
if (typeof rawChunk !== 'string' || !this.splitLargeFrames) {
|
||||
this._webSocket.send(rawChunk);
|
||||
}
|
||||
else {
|
||||
let out = rawChunk;
|
||||
while (out.length > 0) {
|
||||
const chunk = out.substring(0, this.maxWebSocketChunkSize);
|
||||
out = out.substring(this.maxWebSocketChunkSize);
|
||||
this._webSocket.send(chunk);
|
||||
this.debug(`chunk sent = ${chunk.length}, remaining = ${out.length}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
dispose() {
|
||||
if (this.connected) {
|
||||
try {
|
||||
// clone before updating
|
||||
const disconnectHeaders = Object.assign({}, this.disconnectHeaders);
|
||||
if (!disconnectHeaders.receipt) {
|
||||
disconnectHeaders.receipt = `close-${this._counter++}`;
|
||||
}
|
||||
this.watchForReceipt(disconnectHeaders.receipt, frame => {
|
||||
this._closeWebsocket();
|
||||
this._cleanUp();
|
||||
this.onDisconnect(frame);
|
||||
});
|
||||
this._transmit({ command: 'DISCONNECT', headers: disconnectHeaders });
|
||||
}
|
||||
catch (error) {
|
||||
this.debug(`Ignoring error during disconnect ${error}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (this._webSocket.readyState === StompSocketState.CONNECTING ||
|
||||
this._webSocket.readyState === StompSocketState.OPEN) {
|
||||
this._closeWebsocket();
|
||||
}
|
||||
}
|
||||
}
|
||||
_cleanUp() {
|
||||
this._connected = false;
|
||||
if (this._pinger) {
|
||||
clearInterval(this._pinger);
|
||||
}
|
||||
if (this._ponger) {
|
||||
clearInterval(this._ponger);
|
||||
}
|
||||
}
|
||||
publish(params) {
|
||||
const { destination, headers, body, binaryBody, skipContentLengthHeader } = params;
|
||||
const hdrs = Object.assign({ destination }, headers);
|
||||
this._transmit({
|
||||
command: 'SEND',
|
||||
headers: hdrs,
|
||||
body,
|
||||
binaryBody,
|
||||
skipContentLengthHeader,
|
||||
});
|
||||
}
|
||||
watchForReceipt(receiptId, callback) {
|
||||
this._receiptWatchers[receiptId] = callback;
|
||||
}
|
||||
subscribe(destination, callback, headers = {}) {
|
||||
headers = Object.assign({}, headers);
|
||||
if (!headers.id) {
|
||||
headers.id = `sub-${this._counter++}`;
|
||||
}
|
||||
headers.destination = destination;
|
||||
this._subscriptions[headers.id] = callback;
|
||||
this._transmit({ command: 'SUBSCRIBE', headers });
|
||||
const client = this;
|
||||
return {
|
||||
id: headers.id,
|
||||
unsubscribe(hdrs) {
|
||||
return client.unsubscribe(headers.id, hdrs);
|
||||
},
|
||||
};
|
||||
}
|
||||
unsubscribe(id, headers = {}) {
|
||||
headers = Object.assign({}, headers);
|
||||
delete this._subscriptions[id];
|
||||
headers.id = id;
|
||||
this._transmit({ command: 'UNSUBSCRIBE', headers });
|
||||
}
|
||||
begin(transactionId) {
|
||||
const txId = transactionId || `tx-${this._counter++}`;
|
||||
this._transmit({
|
||||
command: 'BEGIN',
|
||||
headers: {
|
||||
transaction: txId,
|
||||
},
|
||||
});
|
||||
const client = this;
|
||||
return {
|
||||
id: txId,
|
||||
commit() {
|
||||
client.commit(txId);
|
||||
},
|
||||
abort() {
|
||||
client.abort(txId);
|
||||
},
|
||||
};
|
||||
}
|
||||
commit(transactionId) {
|
||||
this._transmit({
|
||||
command: 'COMMIT',
|
||||
headers: {
|
||||
transaction: transactionId,
|
||||
},
|
||||
});
|
||||
}
|
||||
abort(transactionId) {
|
||||
this._transmit({
|
||||
command: 'ABORT',
|
||||
headers: {
|
||||
transaction: transactionId,
|
||||
},
|
||||
});
|
||||
}
|
||||
ack(messageId, subscriptionId, headers = {}) {
|
||||
headers = Object.assign({}, headers);
|
||||
if (this._connectedVersion === Versions.V1_2) {
|
||||
headers.id = messageId;
|
||||
}
|
||||
else {
|
||||
headers['message-id'] = messageId;
|
||||
}
|
||||
headers.subscription = subscriptionId;
|
||||
this._transmit({ command: 'ACK', headers });
|
||||
}
|
||||
nack(messageId, subscriptionId, headers = {}) {
|
||||
headers = Object.assign({}, headers);
|
||||
if (this._connectedVersion === Versions.V1_2) {
|
||||
headers.id = messageId;
|
||||
}
|
||||
else {
|
||||
headers['message-id'] = messageId;
|
||||
}
|
||||
headers.subscription = subscriptionId;
|
||||
return this._transmit({ command: 'NACK', headers });
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=stomp-handler.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/stomp-handler.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/stomp-handler.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
12
node_modules/@stomp/stompjs/esm6/stomp-headers.d.ts
generated
vendored
Normal file
12
node_modules/@stomp/stompjs/esm6/stomp-headers.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* STOMP headers. Many functions calls will accept headers as parameters.
|
||||
* The headers sent by Broker will be available as [IFrame#headers]{@link IFrame#headers}.
|
||||
*
|
||||
* `key` and `value` must be valid strings.
|
||||
* In addition, `key` must not contain `CR`, `LF`, or `:`.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export declare class StompHeaders {
|
||||
[key: string]: string;
|
||||
}
|
||||
12
node_modules/@stomp/stompjs/esm6/stomp-headers.js
generated
vendored
Normal file
12
node_modules/@stomp/stompjs/esm6/stomp-headers.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* STOMP headers. Many functions calls will accept headers as parameters.
|
||||
* The headers sent by Broker will be available as [IFrame#headers]{@link IFrame#headers}.
|
||||
*
|
||||
* `key` and `value` must be valid strings.
|
||||
* In addition, `key` must not contain `CR`, `LF`, or `:`.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export class StompHeaders {
|
||||
}
|
||||
//# sourceMappingURL=stomp-headers.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/stomp-headers.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/stomp-headers.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"stomp-headers.js","sourceRoot":"","sources":["../src/stomp-headers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,OAAO,YAAY;CAExB"}
|
||||
16
node_modules/@stomp/stompjs/esm6/stomp-subscription.d.ts
generated
vendored
Normal file
16
node_modules/@stomp/stompjs/esm6/stomp-subscription.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { StompHeaders } from './stomp-headers';
|
||||
/**
|
||||
* Call [Client#subscribe]{@link Client#subscribe} to create a StompSubscription.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export declare class StompSubscription {
|
||||
/**
|
||||
* Id associated with this subscription.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* Unsubscribe. See [Client#unsubscribe]{@link Client#unsubscribe} for an example.
|
||||
*/
|
||||
unsubscribe: (headers?: StompHeaders) => void;
|
||||
}
|
||||
8
node_modules/@stomp/stompjs/esm6/stomp-subscription.js
generated
vendored
Normal file
8
node_modules/@stomp/stompjs/esm6/stomp-subscription.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Call [Client#subscribe]{@link Client#subscribe} to create a StompSubscription.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export class StompSubscription {
|
||||
}
|
||||
//# sourceMappingURL=stomp-subscription.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/stomp-subscription.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/stomp-subscription.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"stomp-subscription.js","sourceRoot":"","sources":["../src/stomp-subscription.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;CAU7B"}
|
||||
140
node_modules/@stomp/stompjs/esm6/types.d.ts
generated
vendored
Normal file
140
node_modules/@stomp/stompjs/esm6/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
import { IFrame } from './i-frame';
|
||||
import { IMessage } from './i-message';
|
||||
import { StompHeaders } from './stomp-headers';
|
||||
/**
|
||||
* This callback will receive a `string` as parameter.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export declare type debugFnType = (msg: string) => void;
|
||||
/**
|
||||
* This callback will receive a {@link IMessage} as parameter.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export declare type messageCallbackType = (message: IMessage) => void;
|
||||
/**
|
||||
* This callback will receive a {@link IFrame} as parameter.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export declare type frameCallbackType = (receipt: IFrame) => void;
|
||||
/**
|
||||
* This callback will receive a [CloseEvent]{@link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent}
|
||||
* as parameter.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export declare type closeEventCallbackType<T = any> = (evt: T) => void;
|
||||
/**
|
||||
* This callback will receive an [Event]{@link https://developer.mozilla.org/en-US/docs/Web/API/Event}
|
||||
* as parameter.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export declare type wsErrorCallbackType<T = any> = (evt: T) => void;
|
||||
/**
|
||||
* Parameters for [Client#publish]{@link Client#publish}.
|
||||
* Aliased as publishParams as well.
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export interface IPublishParams {
|
||||
/**
|
||||
* destination end point
|
||||
*/
|
||||
destination: string;
|
||||
/**
|
||||
* headers (optional)
|
||||
*/
|
||||
headers?: StompHeaders;
|
||||
/**
|
||||
* body (optional)
|
||||
*/
|
||||
body?: string;
|
||||
/**
|
||||
* binary body (optional)
|
||||
*/
|
||||
binaryBody?: Uint8Array;
|
||||
/**
|
||||
* By default a `content-length` header will be added in the Frame to the broker.
|
||||
* Set it to `true` for the header to be skipped.
|
||||
*/
|
||||
skipContentLengthHeader?: boolean;
|
||||
}
|
||||
/**
|
||||
* Backward compatibility, switch to {@link IPublishParams}.
|
||||
*/
|
||||
export declare type publishParams = IPublishParams;
|
||||
/**
|
||||
* Used in {@link IRawFrameType}
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export declare type RawHeaderType = [string, string];
|
||||
/**
|
||||
* The parser yield frames in this structure
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export interface IRawFrameType {
|
||||
command: string;
|
||||
headers: RawHeaderType[];
|
||||
binaryBody: Uint8Array;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface IStompSocketMessageEvent {
|
||||
data?: string | ArrayBuffer;
|
||||
}
|
||||
/**
|
||||
* Copied from Websocket interface to avoid dom typelib dependency.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export interface IStompSocket {
|
||||
onclose: ((this: IStompSocket, ev?: any) => any) | null;
|
||||
onerror: ((this: IStompSocket, ev: any) => any) | null;
|
||||
onmessage: ((this: IStompSocket, ev: IStompSocketMessageEvent) => any) | null;
|
||||
onopen: ((this: IStompSocket, ev?: any) => any) | null;
|
||||
terminate?: ((this: IStompSocket) => any) | null;
|
||||
/**
|
||||
* Returns a string that indicates how binary data from the socket is exposed to scripts:
|
||||
* We support only 'arraybuffer'.
|
||||
*/
|
||||
binaryType: 'arraybuffer';
|
||||
/**
|
||||
* Returns the state of the socket connection. It can have the values of StompSocketState.
|
||||
*/
|
||||
readonly readyState: number;
|
||||
/**
|
||||
* Closes the connection.
|
||||
*/
|
||||
close(): void;
|
||||
/**
|
||||
* Transmits data using the connection. data can be a string or an ArrayBuffer.
|
||||
*/
|
||||
send(data: string | ArrayBuffer): void;
|
||||
}
|
||||
/**
|
||||
* Possible states for the IStompSocket
|
||||
*/
|
||||
export declare enum StompSocketState {
|
||||
CONNECTING = 0,
|
||||
OPEN = 1,
|
||||
CLOSING = 2,
|
||||
CLOSED = 3
|
||||
}
|
||||
/**
|
||||
* Possible activation state
|
||||
*/
|
||||
export declare enum ActivationState {
|
||||
ACTIVE = 0,
|
||||
DEACTIVATING = 1,
|
||||
INACTIVE = 2
|
||||
}
|
||||
20
node_modules/@stomp/stompjs/esm6/types.js
generated
vendored
Normal file
20
node_modules/@stomp/stompjs/esm6/types.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Possible states for the IStompSocket
|
||||
*/
|
||||
export var StompSocketState;
|
||||
(function (StompSocketState) {
|
||||
StompSocketState[StompSocketState["CONNECTING"] = 0] = "CONNECTING";
|
||||
StompSocketState[StompSocketState["OPEN"] = 1] = "OPEN";
|
||||
StompSocketState[StompSocketState["CLOSING"] = 2] = "CLOSING";
|
||||
StompSocketState[StompSocketState["CLOSED"] = 3] = "CLOSED";
|
||||
})(StompSocketState || (StompSocketState = {}));
|
||||
/**
|
||||
* Possible activation state
|
||||
*/
|
||||
export var ActivationState;
|
||||
(function (ActivationState) {
|
||||
ActivationState[ActivationState["ACTIVE"] = 0] = "ACTIVE";
|
||||
ActivationState[ActivationState["DEACTIVATING"] = 1] = "DEACTIVATING";
|
||||
ActivationState[ActivationState["INACTIVE"] = 2] = "INACTIVE";
|
||||
})(ActivationState || (ActivationState = {}));
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/types.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA0IA;;GAEG;AACH,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,mEAAU,CAAA;IACV,uDAAI,CAAA;IACJ,6DAAO,CAAA;IACP,2DAAM,CAAA;AACR,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,yDAAM,CAAA;IACN,qEAAY,CAAA;IACZ,6DAAQ,CAAA;AACV,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B"}
|
||||
39
node_modules/@stomp/stompjs/esm6/versions.d.ts
generated
vendored
Normal file
39
node_modules/@stomp/stompjs/esm6/versions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Supported STOMP versions
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export declare class Versions {
|
||||
versions: string[];
|
||||
/**
|
||||
* Indicates protocol version 1.0
|
||||
*/
|
||||
static V1_0: string;
|
||||
/**
|
||||
* Indicates protocol version 1.1
|
||||
*/
|
||||
static V1_1: string;
|
||||
/**
|
||||
* Indicates protocol version 1.2
|
||||
*/
|
||||
static V1_2: string;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
static default: Versions;
|
||||
/**
|
||||
* Takes an array of string of versions, typical elements '1.0', '1.1', or '1.2'
|
||||
*
|
||||
* You will an instance if this class if you want to override supported versions to be declared during
|
||||
* STOMP handshake.
|
||||
*/
|
||||
constructor(versions: string[]);
|
||||
/**
|
||||
* Used as part of CONNECT STOMP Frame
|
||||
*/
|
||||
supportedVersions(): string;
|
||||
/**
|
||||
* Used while creating a WebSocket
|
||||
*/
|
||||
protocolVersions(): string[];
|
||||
}
|
||||
49
node_modules/@stomp/stompjs/esm6/versions.js
generated
vendored
Normal file
49
node_modules/@stomp/stompjs/esm6/versions.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Supported STOMP versions
|
||||
*
|
||||
* Part of `@stomp/stompjs`.
|
||||
*/
|
||||
export class Versions {
|
||||
/**
|
||||
* Takes an array of string of versions, typical elements '1.0', '1.1', or '1.2'
|
||||
*
|
||||
* You will an instance if this class if you want to override supported versions to be declared during
|
||||
* STOMP handshake.
|
||||
*/
|
||||
constructor(versions) {
|
||||
this.versions = versions;
|
||||
}
|
||||
/**
|
||||
* Used as part of CONNECT STOMP Frame
|
||||
*/
|
||||
supportedVersions() {
|
||||
return this.versions.join(',');
|
||||
}
|
||||
/**
|
||||
* Used while creating a WebSocket
|
||||
*/
|
||||
protocolVersions() {
|
||||
return this.versions.map(x => `v${x.replace('.', '')}.stomp`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Indicates protocol version 1.0
|
||||
*/
|
||||
Versions.V1_0 = '1.0';
|
||||
/**
|
||||
* Indicates protocol version 1.1
|
||||
*/
|
||||
Versions.V1_1 = '1.1';
|
||||
/**
|
||||
* Indicates protocol version 1.2
|
||||
*/
|
||||
Versions.V1_2 = '1.2';
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
Versions.default = new Versions([
|
||||
Versions.V1_0,
|
||||
Versions.V1_1,
|
||||
Versions.V1_2,
|
||||
]);
|
||||
//# sourceMappingURL=versions.js.map
|
||||
1
node_modules/@stomp/stompjs/esm6/versions.js.map
generated
vendored
Normal file
1
node_modules/@stomp/stompjs/esm6/versions.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../src/versions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,QAAQ;IAuBnB;;;;;OAKG;IACH,YAAmB,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;IAAG,CAAC;IAEzC;;OAEG;IACI,iBAAiB;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,gBAAgB;QACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC;IAChE,CAAC;;AA1CD;;GAEG;AACW,aAAI,GAAG,KAAK,CAAC;AAC3B;;GAEG;AACW,aAAI,GAAG,KAAK,CAAC;AAC3B;;GAEG;AACW,aAAI,GAAG,KAAK,CAAC;AAE3B;;GAEG;AACW,gBAAO,GAAG,IAAI,QAAQ,CAAC;IACnC,QAAQ,CAAC,IAAI;IACb,QAAQ,CAAC,IAAI;IACb,QAAQ,CAAC,IAAI;CACd,CAAC,CAAC"}
|
||||
Reference in New Issue
Block a user