public DiscordWebsocketAdapter(URI serverURI,ImplDiscordAPI api,boolean reconnect,String sessionId,int lastSeq){
  this.api=api;
  this.ready=SettableFuture.create();
  registerHandlers();
  this.isReconnect=reconnect;
  this.sessionId=sessionId;
  this.lastSeq=lastSeq;
  WebSocketFactory factory=new WebSocketFactory();
  try {
    factory.setSSLContext(SSLContext.getDefault());
  }
 catch (  NoSuchAlgorithmException e) {
    logger.warn("An error occurred while setting ssl context",e);
  }
  try {
    socket=factory.createSocket(serverURI);
    socket.addListener(this);
    socket.connect();
  }
 catch (  IOException|WebSocketException e) {
    logger.warn("An error occurred while connecting to websocket",e);
  }
}

public DiscordWebsocketAdapter ( URI serverURI , ImplDiscordAPI api , boolean reconnect , String sessionId , int lastSeq ) { this . api = api ; this . ready = SettableFuture . create ( ) ; registerHandlers ( ) ; this . isReconnect = reconnect ; this . sessionId = sessionId ; this . lastSeq = lastSeq ; WebSocketFactory factory = new WebSocketFactory ( ) ; try { factory . setSSLContext ( SSLContext . getDefault ( ) ) ; } catch ( NoSuchAlgorithmException e ) { logger . warn ( "An error occurred while setting ssl context" , e ) ; } try { socket = factory . createSocket ( serverURI ) ; socket . addListener ( this ) ; socket . connect ( ) ; } catch ( IOException | WebSocketException e ) { logger . warn ( "An error occurred while connecting to websocket" , e ) ; } }
creates a new instance of this class .
