Building a Reactive, Distributed Messaging Server in Scala and Akka with WebSockets

If the users of your app have clients of their own they want to communicate with, you will need a messaging service. Here is how to implement one using the WebSocket API — a standard API for client-server communications — on top of Akka HTTP, streams, and typed actors in Scala

Motivation

Tools

System Design

Programming the Server

Step I: Akka HTTP server

Step II: Handling WebSocket Connections

Step III: Sketching out the Program

Step IV: ChatSession and Route

Conclusion