Top Banner
METEOR STACK
25

Understanding Meteor Stack

Apr 13, 2017

Download

Software

Adrian Liaw
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Understanding Meteor Stack

METEOR STACK

Page 2: Understanding Meteor Stack

ABOUT THIS GUY廖偉涵 Wei-Han (Adrian) Liawadrianliaw / adrianliaw2000Homeschooling high school studentPython and Meteor enthusiastCo-organiser of the meetupgithub.com/adrianliaw

Page 3: Understanding Meteor Stack

WHAT THIS TALK IS COVERINGComponents make Meteor workingMeteor stackReplacing components?

Page 4: Understanding Meteor Stack

METEOR IS CUSTOMISABLEUse any UI library you likeYour preferred databaseDDP server/client in any langYeah, and no one would do that

Page 5: Understanding Meteor Stack

STANDARD METEOR APP

Page 6: Understanding Meteor Stack

BLAZEwww.meteor.com/blaze

client-side UI frameworkreactive templatingcompiles HTML into JS

Page 7: Understanding Meteor Stack

REPLACING BLAZE

meteor remove blaze-html-templates

meteor add react (or angular or ...)

meteor add static-html

Page 8: Understanding Meteor Stack

TRACKERwww.meteor.com/tracker

transparent reactive programming~1KBmakes client-side reactivity working(previously called Deps)

Page 9: Understanding Meteor Stack

DDPDistributed Data Protocol

www.meteor.com/ddp

Page 10: Understanding Meteor Stack

DDPData on the wirelike "REST for websockets"client-side Meteor implements DDP clientserver-side Meteor implements DDP serverthe "ddp" package provides client/server DDP

Page 11: Understanding Meteor Stack

DDPstringified JSON over websocketSockJS for supporting older browsers

Page 12: Understanding Meteor Stack

DDP MESSAGE{"msg": "ping"}

{"msg": "method", "method": "foo","params": [], "id": "1"}

Page 13: Understanding Meteor Stack

connection methods data

connect method sub

connected result ready

failed updated added

ping changed

pong removed

unsub

nosub

Page 14: Understanding Meteor Stack

DDP CLIENTSmeteorpedia.com/read/DDP_Clients

Page 15: Understanding Meteor Stack

DDP SERVER

(in-progress)

chees/ddpservermeteorhacks/goddpTarang/DDP-Servercommoncode/django-ddpadrianliaw/meteorish.py

Page 16: Understanding Meteor Stack

FULL-STACK DB DRIVERSWe've got Mongo in Meteor

And people hate it

Page 17: Understanding Meteor Stack

FULL-STACK DB DRIVERSpublish / subscribelive querypure-JS implementationlatency compensation

Page 18: Understanding Meteor Stack

MONGO IN METEORMongo.Cursoroplog tailingMinimongo

Page 19: Understanding Meteor Stack

Meteor.publish("foo", function() { this.added("collname", "docid", {...fields...}); this.ready();});

docs.meteor.com/#/full/meteor_publish

Page 20: Understanding Meteor Stack

Meteor.publish("foo", function() { return MyColl.find();});

Meteor.publish("foo", function() { MyColl.find()._publishCursor(this);});

Page 21: Understanding Meteor Stack

IN THE CLIENTMeteor.connection.registerStore("collname", { "update": function(msg) { if (msg.msg == "added") { ... // Update local cache } else if (msg.msg == "changed") { ... // Update local cache } ... }});

Page 22: Understanding Meteor Stack

ALTERNATIVE DATABASESmeteorpedia.com/read/Alternative_Databases

Page 23: Understanding Meteor Stack
Page 24: Understanding Meteor Stack
Page 25: Understanding Meteor Stack

RESOURCESPro Meteor by Meteorhacks:

DDP spec: Real-time Database by Slava Kim Meteor Explained by Arunoda

meteorhacks.com/pro-meteor/

bit.ly/1h6CLAHyoutu.be/nEjIjJ3TC40

gum.co/meteor-explained