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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.