Socket.subscribe records subscriptions only on ack, narrowing offline replay

Open
#376 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Quiet
Tech stack
typescript
Domain
api, networking

Research direction

Read Socket.subscribe, subscribeAll, and rememberSubscription to understand the acknowledged-versus-optimistic recording paths described here. The issue records a deliberate narrowing rather than requesting a code change; completion would require preserving that behavior and keeping the separate rejection change out of scope.

Written by the indexing model from the issue text.

Description

Subscription recording moved from optimistic pre-send to ack-only. A subscribe that never reaches
the server therefore leaves no record at all, so subscribeAll has nothing to replay for it.

Previously the subscription was written to this.subscriptions before the send, so a subscribe
that failed in flight was still replayable on reconnect. Now the record is written only once the
server acknowledges.

Offline is the case where this bites: the errors raised when there is no connection are sorted into
neither branch of subscribe, and rememberSubscription returns early when there is no
connection, so nothing is recorded and nothing can be replayed.

Why this is being accepted rather than reverted

Ack-only recording is the more accurate record — optimistic recording writes down subscriptions
that may never exist server-side. The consuming application is being changed to re-subscribe its
own streams on reconnect, which removes the need for replay coverage of never-acknowledged
subscriptions.

This issue exists so the narrowing is on record as a deliberate change rather than an unexplained
behavioural difference.

Related

Socket.subscribe also ends in a terminal .catch returning undefined, so callers have no
failure signal at all. That is being addressed separately by making subscribe reject.

Dominant language
TypeScript
Stars
146
Forks
101
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RocketChat/Rocket.Chat.js.SDK

All issues in RocketChat/Rocket.Chat.js.SDK

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.