@@ -72,6 +72,7 @@ func (ws *WebSocketServer) WsPageHandler(w http.ResponseWriter, r *http.Request)
72
72
connectionUrl : fmt .Sprintf ("%v://%v/ws" , serverManager .protocolHttp , r .Host ),
73
73
KeepAliveEnabled : true ,
74
74
keepAliveChanOpen : false ,
75
+ keepAliveSeconds : keepalive_seconds ,
75
76
pingChanOpen : false ,
76
77
}
77
78
@@ -329,6 +330,12 @@ func (ws *WebSocketServer) InitiateRestart() {
329
330
reconnectId = reconnectId [:len (reconnectId )- 1 ]
330
331
clientConnectionUrl := strings .Replace (client .connectionUrl , "http://" , "ws://" , - 1 )
331
332
clientConnectionUrl = strings .Replace (clientConnectionUrl , "https://" , "wss://" , - 1 )
333
+ var reconnecturl string
334
+ if client .keepAliveSeconds != KEEPALIVE_TIMEOUT_SECONDS {
335
+ reconnecturl = fmt .Sprintf ("%v?reconnect_id=%v&keepalive_timeout_seconds=%d" , clientConnectionUrl , reconnectId , client .keepAliveSeconds )
336
+ } else {
337
+ reconnecturl = fmt .Sprintf ("%v?reconnect_id=%v" , clientConnectionUrl , reconnectId )
338
+ }
332
339
reconnectMsg , _ := json .Marshal (
333
340
ReconnectMessage {
334
341
Metadata : MessageMetadata {
@@ -341,7 +348,7 @@ func (ws *WebSocketServer) InitiateRestart() {
341
348
ID : sessionId ,
342
349
Status : "reconnecting" ,
343
350
KeepaliveTimeoutSeconds : nil ,
344
- ReconnectUrl : fmt . Sprintf ( "%v?reconnect_id=%v" , clientConnectionUrl , reconnectId ) ,
351
+ ReconnectUrl : reconnecturl ,
345
352
ConnectedAt : client .ConnectedAtTimestamp ,
346
353
},
347
354
},
0 commit comments