Meteor node upnorth-bobdavies

3,158 views
3,032 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,158
On SlideShare
0
From Embeds
0
Number of Embeds
442
Actions
Shares
0
Downloads
5
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • A surprising amount of people don’t know to do this. Mad.
  • A surprising amount of people don’t know to do this. Mad.
  • A surprising amount of people don’t know to do this. Mad.
  • A surprising amount of people don’t know to do this. Mad.
  • A surprising amount of people don’t know to do this. Mad.
  • A surprising amount of people don’t know to do this. Mad.
  • A surprising amount of people don’t know to do this. Mad.
  • Meteor node upnorth-bobdavies

    1. 1. Meteor Rock your world Bob Davies IndieSpring / Imba Software
    2. 2. What is Meteor? Principles What it actually does How it works (101) http://docs.meteor.com/
    3. 3. Key Principles Data on the Wire. Don't send HTML over the network. Send data and let the client decide how to render it. Full Stack Reactivity. Make realtime the default. All layers event-driven. Simple and Open http://docs.meteor.com/#sevenprinciples
    4. 4. Single Page Focus is on intuitive UX Clean, single page Simple interactions Highly interconnected Socially networked Mashup paradise Simple collaboration platform
    5. 5. Reactive • Templated views • Application reacts to – User actions – Data actions – Remote actions • „Synchronisation‟ is automatic – No transport code needed David Glasser in Chicago - Meteor: Past, Present, & Future: http://youtu.be/r996yhHNs5k?t=11m27s
    6. 6. Realtime • Fetches from MongoDB after every operation – Pushes relevant updates to any subscribed client • Uses fairly sophisticated algorithm to determine what to fetch and for whom. – Also polls every 10 seconds • Mongo oplog when >= Meteor 0.7.0
    7. 7. Session • Session is per-tab – sticky session • Session is retained on hot-code reload, but not on manual refresh (can cause testing issues) • Session stays open for ~15 minutes (memory on server) after socket closes
    8. 8. Comparison Several Thousand lines of code (php + jQuery) Hard to build AND to use
    9. 9. TENs of lines of code Very EASY to build AND use
    10. 10. Application Structure • Simple structure • Client/server separate files – but share most functional code • Publish on server and Subscribe on client • Templated views • MongoDB backend – Can access others via packages – Flexible nosql data source • Backend is very efficient with Fibers
    11. 11. Quickstart // install $ curl https://install.meteor.com/ | sh // create project $ meteor create TestApp // run $ cd TestApp $ meteor => Meteor server running on: localhost:3000 //deploy $ meteor deploy TestApp.meteor.com
    12. 12. Highly Recommended // create project $ meteor create TestApp $ cd TestApp // secure the project meteor remove insecure meteor remove autopublish // run $ meteor => Meteor server running………
    13. 13. Suggested $ mkdir server //Only loads on $ mkdir client //Only loads on $ mkdir public //Static assets $ mkdir shared //Loads on both anything else not in server or folder) server client (as will client • Move (or remove) the premade files – They sort of suck – maybe want templates/views folder too
    14. 14. Publish/Subscribe
    15. 15. Templating
    16. 16. Binding Events Chris Mather: Understanding the Event Loop, Async and Fibers: http://www.youtube.com/watch?v=AWJ8LIzQMHY http://stackoverflow.com/a/20794175/1358220
    17. 17. Allow / Deny
    18. 18. What to build? • Slick UI/UX • Socially Integrated • Collaborative Meteor meets Phonegap with Verso: http://youtu.be/eeY1mZhvDy4?t=6m30s http://madewith.meteor.com/ https://www.meteor.com/blog/2014/01/03/6-must-see-meteor-talks-from-2013
    19. 19. Useful built in packages
    20. 20. Package Management • Meteorite – Smart packages manager – Several router choices – Installs from atmosphere.meteor.com • Can use NPM packages – But may require some custom wrappers • Much better towards 1.0
    21. 21. Challenges • Good habits in old models, sometimes fail you under Meteor – Centralised data model – Flow is different • Some developers prefer the old model – Break out! – Don‟t force MVC or „tack on‟ an extra DAL, let the engine to do the work for you
    22. 22. Into Production • • • • • Setup an appropriate file structure Check your Allow/Deny rules Check what code is shared/private Expect change Optimise Performance – Essentially Node under the hood, though some caveats apply (sticky sessions) Ritik Malhotra: Building a Production-Ready Meteor App: http://www.youtube.com/watch?v=gfFGjmiKfnA
    23. 23. Performance • Not great with static assets, use a CDN and/or static cache if scaling big • Wrap source/subscriptions for logged-in and anonymous users differently – Each subscription requires resources • Use {{#constant}}...{{/constant}} in templates around static content • {“_id”: “abc123”} is very fast when query/update Collection http://meteorhacks.com/does-meteor-scale.html http://projectricochet.com/blog/
    24. 24. Coming Up • 1.0 expected soon (any day) • Newer, faster render engine • Many more packages appearing • Students/kids are learning with Meteor • Lots of startups use it for simple products
    25. 25. So, what is Meteor? • Highly interactive and interconnected • Realtime, reactive • Templated simple user interface/experience • Accessible and manageable code – no callback soup • Scalable and performant • Getting more awesome every day :)
    26. 26. Thank You :) How can you benefit from Meteor? Bob Davies IndieSpring / Imba Software Twitter/Skype @bobbigmac Facebook /bobdavies Blog: http://bobbigmac.com

    ×