WebSockets in Play
WebSockets cannot be defined using Action since they should be bidirectional. Play provides a helper to assist with WebSockets, which is documented at https://www.playframework.com/documentation/2.3.x/api/scala/index.html#play.api.mvc.WebSocket$.
Note
WebSockets, which are defined using the helper, use the Play server's underlying TCP port.
WebSockets can be defined similarly to Actions in Play applications. Starting from Play 2.3, a WebSocket helper finds a method to define WebSocket interactions using an Actor. However, before we learn more about the methods provided by the helper, let's take a small detour and get a little familiar with the Actor Model and Akka Actors.