public void connect() { // if we have channels, then connect, otherwise wait for a channel cancelReconnect(); if (!isConnected() && !isConnecting() && !channels.isEmpty()) { Logger.log(TAG, String.format(Locale.US, "Connecting to %s", socketURI)); setConnectionStatus(ConnectionStatus.CONNECTING); reconnect = true; socketClient.connect(); } }
@Override public void run() { try { mAccessTokens = requestAccessTokens(mUserId, mAuthToken); } catch (JSONException e) { e.printStackTrace(); } if (mAccessTokens == null) { return; } mWebSocketClient = new WebSocketClient(URI.create(HATCHET_URL), TomahawkService.this, null); mWebSocketClient.connect(); }
private void startWebSocketClient() { client = new WebSocketClient(URI.create(WsConfig.URL_WEBSOCKET), clientListener, null); client.connect(); }