fix(realtime): proper reconnect handling for socket.io

Socket.IO seems to include an own reconnect mechanism for some time.
HedgeDoc however built an own reconnect mechanism on top of that.
Since the 'reconnect' event was dropped for socket.io 4.x, the
reconnect-cleanup code didn't run anymore.

This commit fixes this by:
- removing the manual reconnect interval,
- putting the reconnect handler into the correct place,
- setting reconnection options on the server side

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
Erik Michelson
2026-08-21 13:07:30 +02:00
committed by Philip Molares
parent d1ad8d71fe
commit 766d00c4d9
3 changed files with 14 additions and 15 deletions

4
app.js
View File

@@ -89,6 +89,10 @@ const io = new Server(server, {
origin: config.serverURL,
methods: ['GET', 'POST'],
credentials: true
},
connectionStateRecovery: {
maxDisconnectionDuration: 2 * 60 * 1000,
skipMiddlewares: false
}
})