use of org.whispersystems.signalservice.api.websocket.WebSocketUnavailableException in project Signal-Android by WhisperSystems.
the class SignalWebSocket method getWebSocket.
private synchronized WebSocketConnection getWebSocket() throws WebSocketUnavailableException {
if (!canConnect) {
throw new WebSocketUnavailableException();
}
if (webSocket == null || webSocket.isDead()) {
webSocketStateDisposable.dispose();
webSocket = webSocketFactory.createWebSocket();
webSocketStateDisposable = new CompositeDisposable();
Disposable state = webSocket.connect().subscribeOn(Schedulers.computation()).observeOn(Schedulers.computation()).subscribe(webSocketState::onNext);
webSocketStateDisposable.add(state);
}
return webSocket;
}
Aggregations