diff --git a/ts/textsecure/WebSocket.ts b/ts/textsecure/WebSocket.ts index 354adfec06..ec0a0a3057 100644 --- a/ts/textsecure/WebSocket.ts +++ b/ts/textsecure/WebSocket.ts @@ -17,6 +17,7 @@ import { ConnectTimeoutError, HTTPError } from './Errors'; import { handleStatusCode, translateError } from './Utils'; const TEN_SECONDS = 10 * durations.SECOND; +const KEEPALIVE_INTERVAL_MS = TEN_SECONDS; export type IResource = { close(code: number, reason: string): void; @@ -76,6 +77,8 @@ export function connect({ client.on('connect', socket => { Timers.clearTimeout(timer); + socket.socket.setKeepAlive(true, KEEPALIVE_INTERVAL_MS); + resource = createResource(socket); resolve(resource); });