RocketChat / RocketChat/Rocket.Chat.js.SDK
One contract per layer, or keep ISocket and IDriver
Nobody has claimed this yet.
- 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:
DDPDriverimplements both, so at runtime there is exactly one object behind two contracts.- The split is arbitrary:
subscribesits onISocketbutsubscribeRoomonIDriver;loginis onIDriverthoughSocketimplements it;IDriver.configisany;subscribeNotifyUseris declared twice with different return types. - The clients implement
ISocketonly to delegate — that is a facade, not a transport contract.RocketChatClient.socketis typed as the union and nearly every call site casts to pick a half. Protocols.MQTThas no driver and the import is commented out inlib/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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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