code: public void connect() {
          try {
              ws.setPingInterval(pingInterval);
              ws.connect();
          } catch (WebSocketException e){
              e.printStackTrace();
              if(onErrorListener != null) {
                  onErrorListener.onError(e);
              }
              if(tryReconnection) {
                  if (timer == null) {
                      // this is to handle reconnection first time
                      if (lastPongAt == 0) {
                          lastPongAt = 1;
                      }
                      timer = new Timer();
                      timer.scheduleAtFixedRate(getTask(), 0, pongCheckInterval);
                  }
              }
          }
      }
docs: Establishes a web socket connection.