DDP: the real-time API for web applications



DDP: the real-time API for web applications

0 6


ddp-the-real-time-api-for-web-applications


On Github peterpeerdeman / ddp-the-real-time-api-for-web-applications

DDP: the real-time API for web applications

@peterpeerdeman

  • DDP?
Meteor?
Websockets?

Why should I care?

Real-time functionality in webapps expected default
We are going to need to integrate real-time API's
We love to avoid re-inventing the wheel

Distributed Data Protocol

(as per spec)

"a protocol between client and server that supports RPC, the client subscribing to documents and the server sending changes about those documents"

Distributed Data Protocol

(as per matt and peter)

"a unique chance to define interoperability in realtime websockets, as http did for request response"

Distributed Data Protocol

  • Coined March 21, 2012 by Matt DeBergalis
360 lines of readable english
Pub Sub and Remote Procedure Call models
No HTTP / REST / Request-Response
JSON over bi-directional websockets

endpoint15.meteor.com

DDP spec

Connection
Managing Data
Remote Procedure Calls
Errors

DDP spec

Connection

                		
                       CLIENT          SERVER

                    => connect
                                    <= connected
                                    <= failed
                                                        
                    => ping
                                    <= pong
                        
                    

DDP spec

Managing Data

                		
                       CLIENT          SERVER

                    => sub
                                    <= added
                                    <= added
                                    <= ready
                                    <= changed
                                    <= removed
                    => unsub
                                    <= nosub
                        
                    

DDP spec

Remote Procedure Calls

                		
                       CLIENT          SERVER

                    => method
                                    <= result
                                    <= changed
                                    <= updated
                        
                    

DDP spec

errors

                		
                        {
                            "msg": "result",
                            "id": "1",
                            "error": {
                                "error": 404,
                                "reason": "Method not found",
                                "message": "Method not found [404]",
                                "errorType": "Method.Error"
                            }
                        }
                        
                    

Code

endpointcon-map meteor example on github

But I can't use meteor

You don't have to

Code

endpointcon-server node example on github

endpointcon-client javascript example on github

Using DDP

  • Full stack real-time web applications
Realtime functionality in any app
Internet of Things

But, will it scale?

limited to max connections per box
loadbalancing requires session affinity
autoscaling with hosted solutions like modulus

What I ask of you?

Push the web forward!

  • Give DDP a try
Use DDP instead of yet-another-ad-hoc-message-protocol
Voice DDP as standard and push tooling forward

Thank you for your attention

https://github.com/peterpeerdeman/ddp-the-real-time-api-for-web-applications

@peterpeerdeman