Dan node meetup_socket_talk
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
745
On Slideshare
559
From Embeds
186
Number of Embeds
4

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 186

http://g33ktalk.com 95
http://www.hakkalabs.co 88
https://hakka.herokuapp.com 2
https://www.hakkalabs.co 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Realtime at Lore Using Node.js and Socket.io Dan Getelman — May 9, 2012Tuesday, May 15, 12
  • 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. Outline • What we have • How we ended up there • How it works • Lessons learned • Miscellaneous ThoughtsTuesday, May 15, 12
  • 4. What’s our stack? • Rich front-end framework • node.js + socket.io for real-time communications • Python APITuesday, May 15, 12
  • 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. How did we end up here? • Sat down last summer, built it • Pleasantly surprised by ease of socket.io + RedisTuesday, May 15, 12
  • 7. Goals • Build awesome experience for teachers/students • Performance • SecureTuesday, May 15, 12
  • 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. Two Browser Connections API Push HTTPS WebSocket / FallbackTuesday, May 15, 12
  • 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. Redis — Wonderchild • Used in three very different ways, generally happy with all • Message queue • Cache • PubsubTuesday, May 15, 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. Front-end Touchpoints • Receiving and dispatching messages (chat, notifications, updates) • Fetching models • Batch calls to improve performanceTuesday, May 15, 12
  • 14. Running in production • Handling HTTPS • Load balancing • Monit • MetricsTuesday, May 15, 12
  • 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. 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. Thanks! • Follow me on Twitter: @dget • We’re hiring!Tuesday, May 15, 12