2. Distributed Data Protocol.
- Stateful websocket protocol
- Connection between the Server and Client
- Handles Remote Procedure Calls (RPC)
- Manages data
- Meteor uses Version “1” (pre 1.0.0 used
“pre2” or “pre1”
3. Client to Server Connection
Client sends “connect” msg:
{"msg":"connect","version":"1","support":["1","
pre2","pre1"]}
Server sends “connected” msg:
{"msg":"connected","session":"
KXKTWoDXK2n4osF79"}
4. Ping to the Pong
Client sends {"msg":"ping"}
Server sends {"msg":"pong"}
or
Server sends {"msg":"ping"}
Client sends {"msg":"pong"}
In meteor usally the Server sends the ping
5. Remote Procedure Calls
Client sends: {"msg":"method","method":"methodName","
params":[Params values],"id":"messageId"}
Server sends: {"msg":"result","id":"messageId","result":
SomeResult}
Server sends: {"msg":"updated","methods":["messageId"]}
6. Managing Data
msg types:
- sub: Subscribe to a Collection
- unsub: Unsubscribe from a Collection
- nosub: Subscriben is not allowed by the server
- added: A document was added to local set
- changed: A document in the local set has a new value
- removed: A document was removed
- ready: Initial send of data is finished
- addedBefore: like added but in ordered collection with the document Id
after the document added
- moveBefore: if a ordered collection has changed