O'Reilly logo

Building Applications with Scala by Diego Pacheco

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

The chat protocol

Now we will need to define our protocol. For this functionality, we will need three Actors. The Actors that we create will be as follows:

  • ChatRoom: This will have a reference for all users in the chat room
  • ChatUser: This will have one instance per user (active browser)
  • ChatBotAdmin: This simple Bot Admin will provide stats about the chat room

ChatUserActor will need to join JoinChatRoom object in order to start chatting. ChatUserActor will also need to send messages to ChatMessage class to the ChatRoomActor that will broadcast messages to all users. The ChatBotAdmin will get a report from  GetStats object from ChatRoomActor.

Let's start coding this protocol. First, we will need to define the messages that will be exchanged between ...

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