O'Reilly logo

Cross-platform Desktop Application Development: Electron, Node, NW.js, and React by Dmitry Sheiko

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing chat services

I believe that it's more or less clear how WebSockets works now, and we can apply the API for our chat. However, in a real application, we need something more than to echo sent texts. Let's put the intended event scenarios on paper:

  • The Welcome component handles user input and sends via the client to the join server event with the entered user name in the payload
  • The server receives the join event, adds a new user to the set, and broadcasts the participants event with the updated set
  • The client receives the participants event and passes the set to the Participants component, which updates the participant's list
  • The Conversation component handles user input and sends the entered message via the client to the server ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required