src/smart-wss.js
/**
   * Attempts a connection and will either fail or timeout otherwise.
   */
Attempts a connection and will either fail or timeout otherwise.
Attempts a connection and will either fail or timeout otherwise .
_attemptConnect() {
    return new Promise(resolve => {
      let wssPath = this._wssPath;
      this.emit("connecting");
      this._wss = new WebSocket(wssPath);
      this._wss.onopen = () => {
        this._connected = true;
        this.emit("open"); 
        this.emit("connected");
        resolve();
      };
      this._wss.onclose = () => this._closeCallback();
      this._wss.onerror = (err) => this.emit("error", err);
      this._wss.onmessage = (msg) => this.emit("message", msg);
    });
  }
_attemptConnect ( ) { return new Promise ( resolve => { let wssPath = this . _wssPath ; this . emit ( "connecting" ) ; this . _wss = new WebSocket ( wssPath ) ; this . _wss . onopen = ( ) => { this . _connected = true ; this . emit ( "open" ) ; this . emit ( "connected" ) ; resolve ( ) ; } ; this . _wss . onclose = ( ) => this . _closeCallback ( ) ; this . _wss . onerror = ( err ) => this . emit ( "error" , err ) ; this . _wss . onmessage = ( msg ) => this . emit ( "message" , msg ) ; } ) ; }
Attempts a connection and will either fail or timeout otherwise.
Attempts a connection and will either fail or timeout otherwise .
// deprecated