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

673

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
673
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

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
  1. Gostou de algum slide específico?

    Recortar slides é uma maneira fácil de colecionar informações para acessar mais tarde.

×