src/exchanges/gemini-client.js
/** Connect to the websocket stream by constructing a path from
   * the subscribed markets.
   */
Connect to the websocket stream by constructing a path from
the subscribed markets.
Connect to the websocket stream by constructing a path from the subscribed markets .
_connect(remote_id) {
    let forTickers = remote_id.endsWith("-tickers");
    let wssPath = forTickers
      ? `wss://api.gemini.com/v1/marketdata/${remote_id}?heartbeat=true&top_of_book=true`
      : `wss://api.gemini.com/v1/marketdata/${remote_id}?heartbeat=true`;
    let wss = new SmartWss(wssPath);
    wss.on("error", err => this._onError(remote_id, err));
    wss.on("connecting", () => this._onConnecting(remote_id));
    wss.on("connected", () => this._onConnected(remote_id));
    wss.on("disconnected", () => this._onDisconnected(remote_id));
    wss.on("closing", () => this._onClosing(remote_id));
    wss.on("closed", () => this._onClosed(remote_id));
    wss.on("message", raw => {
      try {
        this._onMessage(remote_id, raw);
      } catch (err) {
        this._onError(remote_id, err);
      }
    });
    wss.connect();
    return wss;
  }
_connect ( remote_id ) { let forTickers = remote_id . endsWith ( "-tickers" ) ; let wssPath = forTickers ? ` ${ remote_id } ` : ` ${ remote_id } ` ; let wss = new SmartWss ( wssPath ) ; wss . on ( "error" , err => this . _onError ( remote_id , err ) ) ; wss . on ( "connecting" , ( ) => this . _onConnecting ( remote_id ) ) ; wss . on ( "connected" , ( ) => this . _onConnected ( remote_id ) ) ; wss . on ( "disconnected" , ( ) => this . _onDisconnected ( remote_id ) ) ; wss . on ( "closing" , ( ) => this . _onClosing ( remote_id ) ) ; wss . on ( "closed" , ( ) => this . _onClosed ( remote_id ) ) ; wss . on ( "message" , raw => { try { this . _onMessage ( remote_id , raw ) ; } catch ( err ) { this . _onError ( remote_id , err ) ; } } ) ; wss . connect ( ) ; return wss ; }
Connect to the websocket stream by constructing a path from
 the subscribed markets.
Connect to the websocket stream by constructing a path from the subscribed markets .