RocketChat / RocketChat/Rocket.Chat.js.SDK

One contract per layer, or keep ISocket and IDriver

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

Nobody has claimed this yet.

wayfinder:grilling
Dominant language
TypeScript
Stars
146
Forks
99
Avg merge
7h 59m
Merged PRs (30d)
17

Description

Question

Are ISocket and IDriver the right seam?

Evidence they are not:

  • DDPDriver implements both, so at runtime there is exactly one object behind two contracts.
  • The split is arbitrary: subscribe sits on ISocket but subscribeRoom on IDriver; login is on IDriver though Socket implements it; IDriver.config is any; subscribeNotifyUser is declared twice with different return types.
  • The clients implement ISocket only to delegate — that is a facade, not a transport contract. RocketChatClient.socket is typed as the union and nearly every call site casts to pick a half.
  • Protocols.MQTT has no driver and the import is commented out in lib/clients/Livechat.ts. That dead branch was the only justification for protocol pluggability.

The layering the code actually has is three: the DDP engine (frames, send, open/close, heartbeat), the driver (Rocket.Chat streams, method calls, login), and the client facade (REST plus realtime).

Decide whether to collapse to one contract per layer, whether the client facade is derived from the driver contract or hand-maintained, and whether Protocols.MQTT dies with the split.

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start by comparing ISocket, IDriver, DDPDriver, and the RocketChatClient.socket call sites, noting where casts and delegated implementations occur. Read lib/clients/Livechat.ts and the commented Protocols.MQTT import to understand the remaining protocol path. Done means the layering and contract strategy are decided, affected interfaces and callers are consistently updated, and the MQTT fate is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.