mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 13:49:00 +02:00
[web] restrict external heartbeat/server ping to websocket transport (#23830)
Co-authored-by: Alf Eaton <alf.eaton@overleaf.com> GitOrigin-RevId: c03a78e2c05cd380b705bd14652060980682cb39
This commit is contained in:
@@ -175,7 +175,10 @@ module.exports = Router = {
|
||||
return
|
||||
}
|
||||
const useServerPing =
|
||||
!!client.handshake?.query?.esh && !!client.handshake?.query?.ssp
|
||||
!!client.handshake?.query?.esh &&
|
||||
!!client.handshake?.query?.ssp &&
|
||||
// No server ping with long-polling transports.
|
||||
client.transport === 'websocket'
|
||||
const isDebugging = !!client.handshake?.query?.debugging
|
||||
const projectId = client.handshake?.query?.projectId
|
||||
|
||||
|
||||
@@ -248,10 +248,13 @@ export class ConnectionManager extends EventTarget {
|
||||
if (this.externalHeartbeatInterval) {
|
||||
window.clearInterval(this.externalHeartbeatInterval)
|
||||
}
|
||||
this.externalHeartbeatInterval = window.setInterval(
|
||||
() => this.sendExternalHeartbeat(),
|
||||
15_000
|
||||
)
|
||||
if (this.socket.socket.transport?.name === 'websocket') {
|
||||
// Do not enable external heartbeat on polling transports.
|
||||
this.externalHeartbeatInterval = window.setInterval(
|
||||
() => this.sendExternalHeartbeat(),
|
||||
15_000
|
||||
)
|
||||
}
|
||||
}
|
||||
// Reset on success regardless of transport. We want to upgrade back to websocket on reconnect.
|
||||
this.websocketFailureCount = 0
|
||||
|
||||
Reference in New Issue
Block a user