You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CONTEXT.md draws a clear line between two of these:
Driver — the realtime transport behind a Client, speaking one wire protocol to the server. Explicitly not a Socket.
Socket — the raw websocket inside a Driver.
DDP is the third word in play. In CONTEXT.md it is only ever a qualifier on the wire vocabulary — DDP message, DDP response, DDP error, DDP subscription — never a name for an object. But in the code it is used as a field name for objects, and for two different ones.
Where the names don't line up
Driver.ddp holds a Socket. So the field named after the protocol holds the raw websocket.
RocketChatClient.ddp holds a Driver. Same field name, one level up, different type.
RocketChatClientimplements ISocket, so the Client also claims to be a Socket, which by CONTEXT.md it is not.
The result is that client.ddp.ddp is the Socket, and no field name predicts its own type. Reading a call site does not tell you which layer you are on.
Why it matters
The layers behave very differently — a Driver reconnects, tracks DDP subscriptions and speaks method calls; a Socket opens, closes and carries frames. Code that reaches the wrong one compiles fine and misbehaves at runtime. Rocket.Chat.ReactNative already reaches across the boundary (sdk.current.ddp for driver-level health checks), so the naming is load-bearing outside this repo too.
What to decide
Whether DDP should name an object at all, or stay a qualifier on wire vocabulary as CONTEXT.md has it.
What Driver's field for its Socket should be called.
What a Client's field for its Driver should be called, given ddp is the name consumers already use.
Whether RocketChatClient should keep implements ISocket.
Whether any rename can land without breaking Rocket.Chat.ReactNative, and what the migration looks like if not.
This is a naming and layering review, not a bug — worth settling before more code is written against the current names.
What
CONTEXT.md draws a clear line between two of these:
DDP is the third word in play. In CONTEXT.md it is only ever a qualifier on the wire vocabulary — DDP message, DDP response, DDP error, DDP subscription — never a name for an object. But in the code it is used as a field name for objects, and for two different ones.
Where the names don't line up
Driver.ddpholds aSocket. So the field named after the protocol holds the raw websocket.RocketChatClient.ddpholds aDriver. Same field name, one level up, different type.RocketChatClientimplements ISocket, so the Client also claims to be a Socket, which by CONTEXT.md it is not.RocketChatClientalso carried asocketfield that held aDriver— a third name for the same thing, under the one word CONTEXT.md reserves for the websocket. That field is being removed (see refactor: hold the Driver directly as ddp, instead of an always-resolved socket Promise #336), which is what surfaced the wider problem.The result is that
client.ddp.ddpis the Socket, and no field name predicts its own type. Reading a call site does not tell you which layer you are on.Why it matters
The layers behave very differently — a Driver reconnects, tracks DDP subscriptions and speaks method calls; a Socket opens, closes and carries frames. Code that reaches the wrong one compiles fine and misbehaves at runtime. Rocket.Chat.ReactNative already reaches across the boundary (
sdk.current.ddpfor driver-level health checks), so the naming is load-bearing outside this repo too.What to decide
DDPshould name an object at all, or stay a qualifier on wire vocabulary as CONTEXT.md has it.Driver's field for itsSocketshould be called.Drivershould be called, givenddpis the name consumers already use.RocketChatClientshould keepimplements ISocket.This is a naming and layering review, not a bug — worth settling before more code is written against the current names.