Skip to content

Implement ping/keep-alive messages to prevent websocket connection closure #3656

@bjester

Description

@bjester

Background / Epic: #3630

Observed behavior

  • The connection could timeout from becoming idle causing Cloudflare and/or Google Load Balancer to close the connection

Expected behavior

  • We send periodic messages that will keep the connection alive
  • The periodicity should be easily configurable, and should default to 25 seconds initially
  • A bonus would be to limit these messages to only occur if any other messages hadn't been sent during the period timeframe

User-facing consequences

  • Without these messages, we'd need to rely on connection handling to keep reopening the connection which could cause unnecessary overhead

Additional information

  • Addressing this first will help us iterate and be sure that nothing else is needed to keep the connection alive, before adding defensive handling to the frontend to keep it connected
  • I'm unsure if we also need the server side to respond to these messages to keep the connection alive

Steps to reproduce the issue

  1. Open a channel on the websocket server https://websockets.studio.learningequality.org/ (note: seems like it's no longer connecting)
  2. Open the JS console
  3. Observe leaving it idle, then performing edits, causes error about connection being closed

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions