From a25cdb44ef4738f7c697e0c8aab3e28e673c03c9 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Tue, 1 Nov 2022 11:58:02 +0100 Subject: [PATCH] Fix WS timeouts: Nginx as also a timeout. Seems to be 30s. So we ping every 25s, and set an intermediate timeout for Prosody. --- conversejs/builtin.ts | 2 +- server/lib/prosody/config/content.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conversejs/builtin.ts b/conversejs/builtin.ts index 43ce5dfe..9439724b 100644 --- a/conversejs/builtin.ts +++ b/conversejs/builtin.ts @@ -138,7 +138,7 @@ window.initConverse = async function initConverse ({ assets_path: assetsPath, authentication: 'anonymous', - ping_interval: 60, // must be set accordingly to c2s_close_timeout backend websocket settings + ping_interval: 25, // must be set accordingly to c2s_close_timeout backend websocket settings and nginx timeout auto_login: true, auto_join_rooms: [ room diff --git a/server/lib/prosody/config/content.ts b/server/lib/prosody/config/content.ts index 67fa19f8..473e4dd5 100644 --- a/server/lib/prosody/config/content.ts +++ b/server/lib/prosody/config/content.ts @@ -217,7 +217,8 @@ class ProsodyConfigContent { this.global.set('consider_bosh_secure', true) if (useWS) { this.global.set('consider_websocket_secure', true) - this.global.set('c2s_close_timeout', 65) // must be set accordingly with ConverseJS ping_interval + // c2s_close_timeout must be set accordingly with ConverseJS ping_interval (25s) and nginx timeout (30s) + this.global.set('c2s_close_timeout', 29) // This line seems to be required by Prosody, otherwise it rejects websocket... this.global.set('cross_domain_websocket', [publicServerUrl])