Skip to content

Use HTTP to Check whether Server is Available #52

Open
@Firionus

Description

Currently (feature/patch-ui ff0bbcac), we use reconnecting-websocket to establish a robust WebSocket connection to the Server. However, Firefox has a very strict rate limiter for failed WebSocket connections (https://bugzilla.mozilla.org/show_bug.cgi?id=711793#c0). In the extreme case, we can only check for a WebSocket connection every 60 seconds. So if we try to reconnect every second on Firefox, this is the resulting network traffic:
firefox_reconnecting_websocket_wireshark
The only way to stop this rate limiting is to restart Firefox. Reload does not work. For comparison, Chrome's rate limiting is much less aggressive:
reconnecting_websocket_chrome

However, this means that if we want to support Firefox properly, we need to use a different mechanism than WebSocket connects for checking whether the server is available.

TODO

  • Research how to find out with HTTP whether a server is reachable
    • new API endpoint?
    • or just make a HTTP request to ws?
    • => make a HEAD request to the server. Could only fail if we hit a cache, but I think our server currently forbids browser-side caching.
  • Implement a ConnectionProvider that handles this (class or hook?)
  • check in regular intervals with HTTP whether the server is available
  • if yes, connect WebSocket once or twice
  • if that fails, go back to checking with HTTP
  • communicate the connection state outwards
    • Subscriptions need to be reset when closing
    • Subscriptions need to be made when opening
    • Connection Error Alert needs to be shown when HTTP cannot reach server
    • Connection Error Alert should communicate when the connection is checked (bar going down, countdown, ?)
    • test with Cypress
    • ensure this also works with the frontend dev server

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions