Chapter 14. Realtime with WebSockets

This chapter covers

  • Understanding WebSockets
  • Using the Sails WebSocket client
  • Implementing a chat system in Brushfire
  • Incorporating resourceful pubsub into chat

Brushfire users want to communicate with each other about the videos they’re watching. We’ll satisfy this requirement by implementing a chat system where each video will have its own persistent chat room. Making the chat persistent, meaning storing the chats, will give users the flexibility to interact synchronously (at the same time) or asynchronously (leaving a question that can be answered later).

In this chapter, we’ll differentiate WebSocket events from the HTTP request/ response scheme we’ve used in prior chapters. We’ll show Sails virtual ...

Get Sails.js in Action now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.