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 ...