File

consolidated/stompjs/src/compatibility/compat-client.ts

Description

Available for backward compatibility, please shift to using Client.

Deprecated

Part of @stomp/stompjs.

To upgrade, please follow the Upgrade Guide

Extends

Client

Index

Properties
Methods
Accessors

Properties

Public maxWebSocketFrameSize
Type : number
Default value : 16 * 1024

It is no op now. No longer needed. Large packets work out of the box.

Public appendMissingNULLonIncoming
Type : boolean
Default value : false
Inherited from Client
Defined in Client:143

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.

Public beforeConnect
Type : function
Inherited from Client
Defined in Client:223

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 in this callback.

As of version 5.1, this callback can be async (i.e., it can return a 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.

Public brokerURL
Type : string
Inherited from Client
Defined in Client:43

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 need to be set. If both are set, Client#webSocketFactory will be used.

If your environment does not support WebSockets natively, please refer to Polyfills.

Public connectHeaders
Type : StompHeaders
Inherited from Client
Defined in Client:157

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.

Public connectionTimeout
Type : number
Default value : 0
Inherited from Client
Defined in Client:83

Will retry if Stomp connection is not established in specified milliseconds. Default 0, which implies wait for ever.

Public debug
Type : debugFnType
Inherited from Client
Defined in Client:293

By default, debug messages are discarded. To log to console following can be used:

   *        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.).

Public discardWebsocketOnCommFailure
Type : boolean
Inherited from Client
Defined in Client:301

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).

Public forceBinaryWSFrames
Type : boolean
Default value : false
Inherited from Client
Defined in Client:131

Usually the type of WebSocket frame 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.

Public heartbeatIncoming
Type : number
Default value : 10000
Inherited from Client
Defined in Client:95

Incoming heartbeat interval in milliseconds. Set to 0 to disable.

Public heartbeatOutgoing
Type : number
Default value : 10000
Inherited from Client
Defined in Client:100

Outgoing heartbeat interval in milliseconds. Set to 0 to disable.

Public logRawCommunication
Type : boolean
Inherited from Client
Defined in Client:279

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.

Public maxWebSocketChunkSize
Type : number
Default value : 8 * 1024
Inherited from Client
Defined in Client:121

See splitLargeFrames. This has no effect if splitLargeFrames is false.

Public onChangeState
Type : function
Inherited from Client
Defined in Client:324

It will be called on state change.

When deactivating it may go from ACTIVE to INACTIVE without entering DEACTIVATING.

Public onConnect
Type : frameCallbackType
Inherited from Client
Defined in Client:231

Callback, invoked on every successful connection to the STOMP broker.

The actual FrameImpl will be passed as parameter to the callback. Sometimes clients will like to use headers from this frame.

Public onDisconnect
Type : frameCallbackType
Inherited from Client
Defined in Client:244

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 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 FrameImpl acknowledging the DISCONNECT. You might find Client#onWebSocketClose more appropriate to watch STOMP broker disconnects.

Public onStompError
Type : frameCallbackType
Inherited from Client
Defined in Client:253

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 IFrame will be passed as parameter to the callback.

Public onUnhandledFrame
Type : frameCallbackType
Inherited from Client
Defined in Client:200

Will be invoked if FrameImpl of unknown type is received from the STOMP broker.

The actual IFrame will be passed as parameter to the callback.

Public onUnhandledMessage
Type : messageCallbackType
Inherited from Client
Defined in Client:184

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 from an endpoint.

The actual IMessage will be passed as parameter to the callback.

Public onUnhandledReceipt
Type : frameCallbackType
Inherited from Client
Defined in Client:193

STOMP brokers can be requested to notify when an operation is actually completed. Prefer using Client#watchForReceipt. See Client#watchForReceipt for examples.

The actual FrameImpl will be passed as parameter to the callback.

Public onWebSocketClose
Type : closeEventCallbackType
Inherited from Client
Defined in Client:261

Callback, invoked when underlying WebSocket is closed.

Actual CloseEvent is passed as parameter to the callback.

Public onWebSocketError
Type : wsErrorCallbackType
Inherited from Client
Defined in Client:269

Callback, invoked when underlying WebSocket raises an error.

Actual Event is passed as parameter to the callback.

Public reconnectDelay
Type : number
Default value : 5000
Inherited from Client
Defined in Client:90

automatically reconnect with delay in milliseconds, set to 0 to disable.

Public splitLargeFrames
Type : boolean
Default value : false
Inherited from Client
Defined in Client:115

This switches on a non standard behavior while sending WebSocket packets. It splits larger (text) packets into chunks of 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.

Public state
Type : ActivationState
Default value : ActivationState.INACTIVE
Inherited from Client
Defined in Client:340

Activation state.

It will usually be ACTIVE or INACTIVE. When deactivating it may go from ACTIVE to INACTIVE without entering DEACTIVATING.

Public stompVersions
Default value : Versions.default
Inherited from Client
Defined in Client:54

STOMP versions to attempt during STOMP handshake. By default versions 1.0, 1.1, and 1.2 are attempted.

Example:

   *        // Try only versions 1.0 and 1.1
   *        client.stompVersions = new Versions(['1.0', '1.1'])
   *
Public webSocketFactory
Type : function
Inherited from Client
Defined in Client:77

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. If your STOMP Broker supports WebSockets, prefer setting Client#brokerURL.

If both this and Client#brokerURL are set, this will be used.

Example:

   *        // 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");
   *        };
   *

Methods

Public connect
connect(...args: any[])

Available for backward compatibility, please shift to using 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:

To upgrade, please follow the Upgrade Guide

Parameters :
Name Type Optional
args any[] No
Returns : void
Public disconnect
disconnect(disconnectCallback?: any, headers: StompHeaders)

Available for backward compatibility, please shift to using Client#deactivate.

Deprecated

See: Client#onDisconnect, and Client#disconnectHeaders

To upgrade, please follow the Upgrade Guide

Parameters :
Name Type Optional Default value
disconnectCallback any Yes
headers StompHeaders No {}
Returns : void
Public send
send(destination: string, headers: literal type, body: string)

Available for backward compatibility, use 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

Note: Body must be String. You will need to covert the payload to string in case it is not string (e.g. JSON)

   *        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

Parameters :
Name Type Optional Default value
destination string No
headers literal type No {}
body string No ''
Returns : void
Public abort
abort(transactionId: string)
Inherited from Client
Defined in Client:758

Abort a transaction. It is preferable to abort a transaction by calling abort directly on ITransaction returned by client.begin.

   *        var tx = client.begin(txId);
   *        //...
   *        tx.abort();
   *
Parameters :
Name Type Optional
transactionId string No
Returns : void
Public ack
ack(messageId: string, subscriptionId: string, headers: StompHeaders)
Inherited from Client
Defined in Client:775

ACK a message. It is preferable to acknowledge a message by calling ack directly on the IMessage handled by a subscription callback:

   *        var callback = function (message) {
   *          // process the message
   *          // acknowledge it
   *          message.ack();
   *        };
   *        client.subscribe(destination, callback, {'ack': 'client'});
   *
Parameters :
Name Type Optional Default value
messageId string No
subscriptionId string No
headers StompHeaders No {}
Returns : void
Public activate
activate()
Inherited from Client
Defined in Client:386

Initiate the connection with the broker. If the connection breaks, as per Client#reconnectDelay, it will keep trying to reconnect.

Call Client#deactivate to disconnect and stop reconnection attempts.

Returns : void
Public begin
begin(transactionId?: string)
Inherited from Client
Defined in Client:727

Start a transaction, the returned ITransaction has methods - commit and abort.

transactionId is optional, if not passed the library will generate it internally.

Parameters :
Name Type Optional
transactionId string Yes
Returns : ITransaction
Public commit
commit(transactionId: string)
Inherited from Client
Defined in Client:743

Commit a transaction.

It is preferable to commit a transaction by calling commit directly on ITransaction returned by client.begin.

   *        var tx = client.begin(txId);
   *        //...
   *        tx.commit();
   *
Parameters :
Name Type Optional
transactionId string No
Returns : void
Public configure
configure(conf: StompConfig)
Inherited from Client
Defined in Client:374

Update configuration.

Parameters :
Name Type Optional
conf StompConfig No
Returns : void
Public Async deactivate
deactivate()
Inherited from Client
Defined in Client:538

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.

Returns : Promise<void>
Public forceDisconnect
forceDisconnect()
Inherited from Client
Defined in Client:580

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 as well.

Returns : void
Public nack
nack(messageId: string, subscriptionId: string, headers: StompHeaders)
Inherited from Client
Defined in Client:796

NACK a message. It is preferable to acknowledge a message by calling nack directly on the IMessage handled by a subscription callback:

   *        var callback = function (message) {
   *          // process the message
   *          // an error occurs, nack it
   *          message.nack();
   *        };
   *        client.subscribe(destination, callback, {'ack': 'client'});
   *
Parameters :
Name Type Optional Default value
messageId string No
subscriptionId string No
headers StompHeaders No {}
Returns : void
Public publish
publish(params: IPublishParams)
Inherited from Client
Defined in Client:630

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. 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.

   *        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'}});
   *
Parameters :
Name Type Optional
params IPublishParams No
Returns : void
Public subscribe
subscribe(destination: string, callback: messageCallbackType, headers: StompHeaders)
Inherited from Client
Defined in Client:697

Subscribe to a STOMP Broker location. The callback will be invoked for each received message with the 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.

   *        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 });
   *
Parameters :
Name Type Optional Default value
destination string No
callback messageCallbackType No
headers StompHeaders No {}
Returns : StompSubscription
Public unsubscribe
unsubscribe(id: string, headers: StompHeaders)
Inherited from Client
Defined in Client:717

It is preferable to unsubscribe from a subscription by calling unsubscribe() directly on StompSubscription returned by client.subscribe():

   *        var subscription = client.subscribe(destination, onmessage);
   *        // ...
   *        subscription.unsubscribe();
   *

See: http://stomp.github.com/stomp-specification-1.2.html#UNSUBSCRIBE UNSUBSCRIBE Frame

Parameters :
Name Type Optional Default value
id string No
headers StompHeaders No {}
Returns : void
Public watchForReceipt
watchForReceipt(receiptId: string, callback: frameCallbackType)
Inherited from Client
Defined in Client:669

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 FrameImpl will be passed as parameter to the callback.

Example:

   *        // 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});
   *
Parameters :
Name Type Optional
receiptId string No
callback frameCallbackType No
Returns : void

Accessors

reconnect_delay
setreconnect_delay(value: number)

Available for backward compatibility, renamed to Client#reconnectDelay.

Deprecated

Parameters :
Name Type Optional
value number No
Returns : void
ws
getws()

Available for backward compatibility, renamed to Client#webSocket.

Deprecated

Returns : any
version
getversion()

Available for backward compatibility, renamed to Client#connectedVersion.

Deprecated

onreceive
getonreceive()

Available for backward compatibility, renamed to Client#onUnhandledMessage.

Deprecated

setonreceive(value)

Available for backward compatibility, renamed to Client#onUnhandledMessage.

Deprecated

Parameters :
Name Optional
value No
Returns : void
onreceipt
getonreceipt()

Available for backward compatibility, renamed to Client#onUnhandledReceipt. Prefer using Client#watchForReceipt.

Deprecated

Returns : frameCallbackType
setonreceipt(value)

Available for backward compatibility, renamed to Client#onUnhandledReceipt.

Deprecated

Parameters :
Name Optional
value No
Returns : void
heartbeat
getheartbeat()

Available for backward compatibility, renamed to Client#heartbeatIncoming Client#heartbeatOutgoing.

Deprecated

setheartbeat(value: literal type)

Available for backward compatibility, renamed to Client#heartbeatIncoming Client#heartbeatOutgoing.

Deprecated

Parameters :
Name Type Optional
value literal type No
Returns : void
import { Client } from '../client';
import { StompHeaders } from '../stomp-headers';
import { frameCallbackType, messageCallbackType } from '../types';
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 {
  /**
   * It is no op now. No longer needed. Large packets work out of the box.
   */
  public maxWebSocketFrameSize: number = 16 * 1024;

  /**
   * Available for backward compatibility, please shift to using {@link Client}
   * and [Client#webSocketFactory]{@link Client#webSocketFactory}.
   *
   * **Deprecated**
   *
   * @internal
   */
  constructor(webSocketFactory: () => any) {
    super();
    this.reconnect_delay = 0;
    this.webSocketFactory = webSocketFactory;
    // Default from previous version
    this.debug = (...message: any[]) => {
      console.log(...message);
    };
  }

  private _parseConnect(...args: any[]): any {
    let closeEventCallback;
    let connectCallback;
    let errorCallback;
    let headers: StompHeaders = {};
    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)
   */
  public connect(...args: any[]): void {
    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)
   */
  public disconnect(
    disconnectCallback?: any,
    headers: StompHeaders = {}
  ): void {
    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)
   */
  public send(
    destination: string,
    headers: { [key: string]: any } = {},
    body: string = ''
  ): void {
    headers = (Object as any).assign({}, headers);

    const skipContentLengthHeader = headers['content-length'] === false;
    if (skipContentLengthHeader) {
      delete headers['content-length'];
    }
    this.publish({
      destination,
      headers: headers as StompHeaders,
      body,
      skipContentLengthHeader,
    });
  }

  /**
   * Available for backward compatibility, renamed to [Client#reconnectDelay]{@link Client#reconnectDelay}.
   *
   * **Deprecated**
   */
  set reconnect_delay(value: number) {
    this.reconnectDelay = value;
  }

  /**
   * Available for backward compatibility, renamed to [Client#webSocket]{@link Client#webSocket}.
   *
   * **Deprecated**
   */
  get ws(): any {
    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(): messageCallbackType {
    return this.onUnhandledMessage;
  }

  /**
   * Available for backward compatibility, renamed to [Client#onUnhandledMessage]{@link Client#onUnhandledMessage}.
   *
   * **Deprecated**
   */
  set onreceive(value: messageCallbackType) {
    this.onUnhandledMessage = value;
  }

  /**
   * Available for backward compatibility, renamed to [Client#onUnhandledReceipt]{@link Client#onUnhandledReceipt}.
   * Prefer using [Client#watchForReceipt]{@link Client#watchForReceipt}.
   *
   * **Deprecated**
   */
  get onreceipt(): frameCallbackType {
    return this.onUnhandledReceipt;
  }

  /**
   * Available for backward compatibility, renamed to [Client#onUnhandledReceipt]{@link Client#onUnhandledReceipt}.
   *
   * **Deprecated**
   */
  set onreceipt(value: frameCallbackType) {
    this.onUnhandledReceipt = value;
  }

  private _heartbeatInfo: HeartbeatInfo = new HeartbeatInfo(this);

  /**
   * 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: { incoming: number; outgoing: number }) {
    this.heartbeatIncoming = value.incoming;
    this.heartbeatOutgoing = value.outgoing;
  }
}

result-matching ""

    No results matching ""