Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Realtime at Lore                      Using Node.js and Socket.io                      Dan Getelman — May 9, 2012Tuesday, ...
Why am I here?                      • CTO/Co-founder at Lore (formerly                        Coursekit)                  ...
Outline                      • What we have                      • How we ended up there                      • How it wor...
What’s our stack?                      • Rich front-end framework                      • node.js + socket.io for real-time...
How did we end up                             here?                      • Build best experience possible                 ...
How did we end up                             here?                      • Sat down last summer, built it                 ...
Goals                      • Build awesome experience for                        teachers/students                      • ...
Data Model                              Restrictions                      • Permission Groups let us simplify             ...
Two Browser                       Connections                 API                 Push                        HTTPS       ...
Beauty of Push                              Server                      • Fills two roles:                       • Lets us...
Redis — Wonderchild                      • Used in three very different ways,                        generally happy with ...
How It Fits Together                      • Subscribe to models (message via                        socket.io)            ...
Front-end                              Touchpoints                      • Receiving and dispatching messages              ...
Running in                              production                      • Handling HTTPS                      • Load balan...
HTTPS                 https = require https                 privateKey = fs.readFileSync("key.key").toString()            ...
Lessons Learned                      • Log everything                      • Measure everything                      • Uns...
Thanks!                      • Follow me on Twitter: @dget                      • We’re hiring!Tuesday, May 15, 12
Upcoming SlideShare
Loading in …5
×

Dan node meetup_socket_talk

886 views

Published on

  • Be the first to comment

  • Be the first to like this

Dan node meetup_socket_talk

  1. 1. Realtime at Lore Using Node.js and Socket.io Dan Getelman — May 9, 2012Tuesday, May 15, 12
  2. 2. Why am I here? • CTO/Co-founder at Lore (formerly Coursekit) • We built a system where real-time updates are global. It’s been happily running in production for about a year.Tuesday, May 15, 12
  3. 3. Outline • What we have • How we ended up there • How it works • Lessons learned • Miscellaneous ThoughtsTuesday, May 15, 12
  4. 4. What’s our stack? • Rich front-end framework • node.js + socket.io for real-time communications • Python APITuesday, May 15, 12
  5. 5. How did we end up here? • Build best experience possible • Strong vision for what we wanted — solving general case way less work than tons of specifics • Able to leverage infrastructure both for speed gains and real-time updatingTuesday, May 15, 12
  6. 6. How did we end up here? • Sat down last summer, built it • Pleasantly surprised by ease of socket.io + RedisTuesday, May 15, 12
  7. 7. Goals • Build awesome experience for teachers/students • Performance • SecureTuesday, May 15, 12
  8. 8. Data Model Restrictions • Permission Groups let us simplify updates significantly • Individual models being pushed to front- end • Originally, circular dependencies not allowedTuesday, May 15, 12
  9. 9. Two Browser Connections API Push HTTPS WebSocket / FallbackTuesday, May 15, 12
  10. 10. Beauty of Push Server • Fills two roles: • Lets us bypass browser concurrent requests limits • Lets us push any changes relevant to a user down the pipe • Socket.io generally lets us do this without worrying about browsersTuesday, May 15, 12
  11. 11. Redis — Wonderchild • Used in three very different ways, generally happy with all • Message queue • Cache • PubsubTuesday, May 15, 12
  12. 12. How It Fits Together • Subscribe to models (message via socket.io) • On write, determine which models care about the change / addition • Publish to their channel in RedisTuesday, May 15, 12
  13. 13. Front-end Touchpoints • Receiving and dispatching messages (chat, notifications, updates) • Fetching models • Batch calls to improve performanceTuesday, May 15, 12
  14. 14. Running in production • Handling HTTPS • Load balancing • Monit • MetricsTuesday, May 15, 12
  15. 15. HTTPS https = require https privateKey = fs.readFileSync("key.key").toString() certificate = fs.readFileSync("ssl.pem").toString() ca1 = fs.readFileSync("blah.pem").toString() https.createServer {key:privateKey,cert:certificate, ca: [ca1]}Tuesday, May 15, 12
  16. 16. Lessons Learned • Log everything • Measure everything • Unstable standards are unstable • socket.io can be a bit opaque if things aren’t going wellTuesday, May 15, 12
  17. 17. Thanks! • Follow me on Twitter: @dget • We’re hiring!Tuesday, May 15, 12

×