meteor mit tech talk 9/18/14: designing a new platform for modern apps
TRANSCRIPT
Designing a New Platform for Modern Apps Emily Stark, MIT SM ‘13!Sashko Stubailo, MIT ‘14!Core Developers at Meteor
What is Meteor?!http://github.com/meteor/meteor
• An open source JavaScript client and server application framework
• Build fast, modern, high quality apps in a fraction of the time
http://meteor.com
1. Instant Response
http://meteor.com
You don’t have to wait for the round-trip to the server.
2. Reactive UI The UI is always up to date with the data.
3. Fast Load Time The whole UI is sent to the client once, so subsequent loads are fast.
4. Multiple Platforms You can access the same data through several websites and mobile apps.
Features of Modern Web Apps!
What makes this possible?!
http://meteor.com
1. Instant Response 2. Reactive UI 3. Fast Load Time 4. Multiple Platforms
Features!• Latency compensation • Rendering views on the client • Subscribing to data from the server • Client-side data caching
Implementation Requirements!
How does Meteor do this stuff?!
http://meteor.com
Livequery (Real-time MongoDB)
Tracker (Dependency Tracking)
Blaze (Reactive HTML Rendering)
Minimongo (Client-Side Cache)
DDP (Distributed Data Protocol)
Server
Client
DDP (Distributed Data Protocol)!• A simple, human-readable protocol for remote
procedure calls and data synchronization
Let’s go back to our demo to see it in action!
http://meteor.com
DDP Messages!
http://meteor.com
Publish and Subscribe Client è Server! Server è Client!
sub unsub
added changed removed ready
Remote Procedure Calls – “Methods” Client è Server! Server è Client!
method result updated
See the detailed spec at ddp.meteor.com!
DDP (Distributed Data Protocol)!• Pub/sub and RPC in one protocol
• Enable latency compensation • Helps you avoid data race conditions • Ensures consistency between client and server
• Better than REST for modern web apps - enables all of the cool
features we saw earlier
• Could replace non-standard live data APIs such as Twitter and Dropbox with one protocol
http://meteor.com
Meteor DDP API!
http://meteor.com
Publish and Subscribe
Remote Procedure Calls – “Methods”
// on the server Meteor.publish(“players”, function () { return Players.find(); });
// on the server Meteor.methods({ givePoints: function (playerId) { Players.update(/* query */); } });
// on the client Meteor.subscribe(“players”, onReady); Players.find() // get the data
// on the client Meteor.call(“givePoints”, playerId, onResult);
What could you make with DDP?!• Build your own DDP client or server to provide or consume data • Proxy a streaming API to DDP so other people can use it
• Build a system that replicates data across a mesh network
Meteor is our implementation; also check out the community implementations for Ruby, Python, Java, and more.
http://meteor.com
Meteor is hiring!!• Full-time, in San Francisco and remotely • Interns for Winter, Spring, and Summer
http://meteor.com
Check out meteor.com/jobs!
Contact us!!
Emily Stark @estark37 [email protected] Sashko Stubailo @stubailo [email protected]