Search in sources :

Example 1 with WebSocketFactory

use of org.whispersystems.signalservice.api.websocket.WebSocketFactory in project signal-cli by AsamK.

the class SignalDependencies method getSignalWebSocket.

public SignalWebSocket getSignalWebSocket() {
    return getOrCreate(() -> signalWebSocket, () -> {
        final var timer = new UptimeSleepTimer();
        final var healthMonitor = new SignalWebSocketHealthMonitor(timer);
        final var webSocketFactory = new WebSocketFactory() {

            @Override
            public WebSocketConnection createWebSocket() {
                return new WebSocketConnection("normal", serviceEnvironmentConfig.getSignalServiceConfiguration(), Optional.of(credentialsProvider), userAgent, healthMonitor);
            }

            @Override
            public WebSocketConnection createUnidentifiedWebSocket() {
                return new WebSocketConnection("unidentified", serviceEnvironmentConfig.getSignalServiceConfiguration(), Optional.empty(), userAgent, healthMonitor);
            }
        };
        signalWebSocket = new SignalWebSocket(webSocketFactory);
        healthMonitor.monitor(signalWebSocket);
    });
}
Also used : UptimeSleepTimer(org.whispersystems.signalservice.api.util.UptimeSleepTimer) WebSocketConnection(org.whispersystems.signalservice.internal.websocket.WebSocketConnection) WebSocketFactory(org.whispersystems.signalservice.api.websocket.WebSocketFactory) SignalWebSocket(org.whispersystems.signalservice.api.SignalWebSocket)

Aggregations

SignalWebSocket (org.whispersystems.signalservice.api.SignalWebSocket)1 UptimeSleepTimer (org.whispersystems.signalservice.api.util.UptimeSleepTimer)1 WebSocketFactory (org.whispersystems.signalservice.api.websocket.WebSocketFactory)1 WebSocketConnection (org.whispersystems.signalservice.internal.websocket.WebSocketConnection)1