@Override public WebSocket call() throws WebSocketException { return mWebSocket.connect(); } }
@Override public void runMain() { try { mWebSocket.connect(); } catch (WebSocketException e) { handleError(e); } }
protected synchronized void connect() { if (api.getStatus() != JDA.Status.ATTEMPTING_TO_RECONNECT) api.setStatus(JDA.Status.CONNECTING_TO_WEBSOCKET); if (shutdown) throw new RejectedExecutionException("JDA is shutdown!"); initiating = true; String url = api.getGatewayUrl() + "?encoding=json&v=" + DISCORD_GATEWAY_VERSION; if (compression) { url += "&compress=zlib-stream"; decompressBuffer = newDecompressBuffer(); } try { socket = api.getWebSocketFactory() .createSocket(url) .addHeader("Accept-Encoding", "gzip") .addListener(this); socket.connect(); } catch (IOException | WebSocketException e) { api.resetGatewayUrl(); //Completely fail here. We couldn't make the connection. throw new IllegalStateException(e); } }
@Override public WebSocket call() throws WebSocketException { return mWebSocket.connect(); } }
@Override public void runMain() { try { mWebSocket.connect(); } catch (WebSocketException e) { handleError(e); } }
/** * Connecting to IRC-WS */ @Synchronized public void connect() { if (connectionState.equals(TMIConnectionState.DISCONNECTED) || connectionState.equals(TMIConnectionState.RECONNECTING)) { try { // Change Connection State connectionState = TMIConnectionState.CONNECTING; // Recreate Socket if state does not equal CREATED createWebSocket(); // Connect to IRC WebSocket this.webSocket.connect(); } catch (Exception ex) { log.error("Connection to Twitch IRC failed: {} - Retrying ...", ex.getMessage()); // Sleep 1 second before trying to reconnect try { Thread.sleep(1000); } catch (Exception et) { } // reconnect reconnect(); } } }
/** * Connecting to IRC-WS */ @Synchronized public void connect() { if (connectionState.equals(TMIConnectionState.DISCONNECTED) || connectionState.equals(TMIConnectionState.RECONNECTING)) { try { // Change Connection State connectionState = TMIConnectionState.CONNECTING; // Recreate Socket if state does not equal CREATED createWebSocket(); // Connect to IRC WebSocket this.webSocket.connect(); } catch (Exception ex) { log.error("PubSub: Connection to Twitch PubSub failed: {} - Retrying ...", ex.getMessage()); // Sleep 1 second before trying to reconnect try { Thread.sleep(1000); } catch (Exception et) { } // reconnect reconnect(); } } }
ws.connect(); } catch (OpeningHandshakeException e) {
private void connect(String url) { WebSocketFactory factory = new WebSocketFactory(); if (proxy != null) { ProxySettings settings = factory.getProxySettings(); settings.setHost(proxy.getHostName()); settings.setPort(proxy.getPort()); } try { socket = factory.createSocket(url) .addHeader("Accept-Encoding", "gzip") .addListener(this); socket.connect(); } catch (IOException | WebSocketException e) { //Completely fail here. We couldn't make the connection. throw new RuntimeException(e); } }
mConnection.connect();
websocket.addListener(new WebSocketLogger()); waitForIdentifyRateLimit(); websocket.connect(); } catch (Throwable t) { logger.warn("An error occurred while connecting to websocket", t);
ws.addListener(new WSListener()); ws.addExtension(WebSocketExtension.parse(WebSocketExtension.PERMESSAGE_DEFLATE)); ws.connect(); } catch (Exception e) { e.printStackTrace();