Socket has no single owner for work in flight when the connection changes

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

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Quiet
Tech stack
typescript
Domain
networking

Research direction

Start in lib/drivers/ddp.ts at createConnection (112-122), onClose (178), and send (427-430), then read ADR-0005's Consequences section. Define one connection-ownership or generation seam that covers all three stale-work checks while preserving their current behavior; done means those checks no longer duplicate the rule.

Written by the indexing model from the issue text.

Description

Three places each answer "is this still my connection?" on their own:

  • createConnection orphan teardown (lib/drivers/ddp.ts:112-122)
  • onClose(ev, connection) identity compare (lib/drivers/ddp.ts:178)
  • send, capturing the connection and comparing after waitForOpen (lib/drivers/ddp.ts:427-430)

They agree with each other today, so nothing is broken. But the rule is written out three times rather than held in one place, and the next site that needs it will be a fourth copy.

Possible shape: createConnection yields an object holding the socket plus a generation. One seam drops stale-generation work and all three checks collapse into it.

ADR-0005 already names this as open in its Consequences, but an ADR sentence is not tracking.

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.