Skip to content

Commit

Permalink
[fix] [#431] Some disconnected user-ids not removed from `connected-u…
Browse files Browse the repository at this point in the history
…ids`

Big thanks to @krajj7 for the report and huge assistance debugging!

As part of the investigation into this issue, and due to another recent
related issue (#429), I decided that we were overdue for a refactor
of Sente's connection management system.

The old system had grown overly complex, and left too much room for
edge cases and timing issues.

This commit introduces a major refactor of the system, with an
emphasis on robustness and improved observability.

Specific improvements include:

  - New internal "conn-id" concept that:
    1. No longer depends on http server implementations to
       properly implement identity
    2. Greatly improves logging output, easing debugging

  - General logging improvements to ease debugging
  - Now expose internal `conns_` state to ease debugging

  - Added server-side ping timeout to match client side,
    and to catch unexpected cases where http server is
    never able to identify a connection as broken.

    Note that this new feature is currently opt-in[1], but
    will be enabled by default in a future release.

  - Simplified internal API for updating `conns_` state.

  - More robust handling when events fire in unexpected
    order (e.g. :on-close firing before :on-open handshake).

  - Generally improved clarity and robustness.

Note: some related additions will also be made to the
reference example project in another commit.

[1] Provide a value (e.g. 5000) for the new `:ws-ping-timeout-ms`
    option to `make-channel-socket-server!`
  • Loading branch information
ptaoussanis committed Jul 13, 2023
1 parent d0fd918 commit 0dc8a12
Showing 1 changed file with 344 additions and 306 deletions.
Loading

0 comments on commit 0dc8a12

Please sign in to comment.