Change websocket keepalive response time to 20s.

This commit is contained in:
Clark
2023-07-13 14:22:10 -04:00
committed by GitHub
parent 47673be4e0
commit f579b79d2e
2 changed files with 43 additions and 15 deletions
@@ -58,8 +58,8 @@ import static org.whispersystems.signalservice.internal.websocket.WebSocketProto
public class WebSocketConnection extends WebSocketListener {
private static final String TAG = WebSocketConnection.class.getSimpleName();
public static final int KEEPALIVE_TIMEOUT_SECONDS = 30;
private static final String TAG = WebSocketConnection.class.getSimpleName();
public static final int KEEPALIVE_FREQUENCY_SECONDS = 30;
private final LinkedList<WebSocketRequestMessage> incomingRequests = new LinkedList<>();
private final Map<Long, OutgoingRequest> outgoingRequests = new HashMap<>();
@@ -143,9 +143,9 @@ public class WebSocketConnection extends WebSocketListener {
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder().sslSocketFactory(new Tls12SocketFactory(socketFactory.first()),
socketFactory.second())
.connectionSpecs(serviceUrl.getConnectionSpecs().orElse(Util.immutableList(ConnectionSpec.RESTRICTED_TLS)))
.readTimeout(KEEPALIVE_TIMEOUT_SECONDS + 10, TimeUnit.SECONDS)
.readTimeout(KEEPALIVE_FREQUENCY_SECONDS + 10, TimeUnit.SECONDS)
.dns(dns.orElse(Dns.SYSTEM))
.connectTimeout(KEEPALIVE_TIMEOUT_SECONDS + 10, TimeUnit.SECONDS);
.connectTimeout(KEEPALIVE_FREQUENCY_SECONDS + 10, TimeUnit.SECONDS);
for (Interceptor interceptor : interceptors) {
clientBuilder.addInterceptor(interceptor);