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  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  Client * and [Client#webSocketFactory] Client .
     *
     * **Deprecated**
     *
     *  internal constructor ( webSocketFactory ) { super ( ) ; this . reconnect_delay = 0 ; this . webSocketFactory = webSocketFactory ; this . debug = ( ... message ) => { console . log ( ... message ) ; } ; } private _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] Client .
     *
     * **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] Client * - connectCallback, see [Client#onConnect] Client * - errorCallback, see [Client#onStompError] Client * - closeEventCallback, see [Client#onWebSocketClose] Client * - 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 ) { 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] Client .
     *
     * **Deprecated**
     *
     * See:
     * [Client#onDisconnect] Client , and
     * [Client#disconnectHeaders] Client *
     * To upgrade, please follow the [Upgrade Guide](../additional-documentation/upgrading.html)
      public disconnect ( disconnectCallback ? , headers = { } ) { if ( disconnectCallback ) { this . onDisconnect = disconnectCallback ; } this . disconnectHeaders = headers ; super . deactivate ( ) ; } /**
     * Available for backward compatibility, use [Client#publish] Client .
     *
     * 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] Client *
     * 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 , headers = { } , body = '' ) { 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] Client .
     *
     * **Deprecated**
      set reconnect_delay ( value ) { this . reconnectDelay = value ; } /**
     * Available for backward compatibility, renamed to [Client#webSocket] Client .
     *
     * **Deprecated**
      get ws ( ) : any { return this . webSocket ; } /**
     * Available for backward compatibility, renamed to [Client#connectedVersion] Client .
     *
     * **Deprecated**
      get version ( ) { return this . connectedVersion ; } /**
     * Available for backward compatibility, renamed to [Client#onUnhandledMessage] Client .
     *
     * **Deprecated**
      get onreceive ( ) : messageCallbackType { return this . onUnhandledMessage ; } /**
     * Available for backward compatibility, renamed to [Client#onUnhandledMessage] Client .
     *
     * **Deprecated**
      set onreceive ( value ) { this . onUnhandledMessage = value ; } /**
     * Available for backward compatibility, renamed to [Client#onUnhandledReceipt] Client .
     * Prefer using [Client#watchForReceipt] Client .
     *
     * **Deprecated**
      get onreceipt ( ) : frameCallbackType { return this . onUnhandledReceipt ; } /**
     * Available for backward compatibility, renamed to [Client#onUnhandledReceipt] Client .
     *
     * **Deprecated**
      set onreceipt ( value ) { this . onUnhandledReceipt = value ; } private _heartbeatInfo : HeartbeatInfo = new HeartbeatInfo ( this ) ; /**
     * Available for backward compatibility, renamed to [Client#heartbeatIncoming] Client * [Client#heartbeatOutgoing] Client .
     *
     * **Deprecated**
      get heartbeat ( ) { return this . _heartbeatInfo ; } /**
     * Available for backward compatibility, renamed to [Client#heartbeatIncoming] Client * [Client#heartbeatOutgoing] Client .
     *
     * **Deprecated**
      set heartbeat ( value ) { this . heartbeatIncoming = value . incoming ; this . heartbeatOutgoing = value . outgoing ; } }