Websocket creation in Play 2.6

websockets

(Gregoire Spiers) #1

I am trying to do the following with Play Framework 2.6 :

  1. The browser targets the server and a websocket is created
  2. Later on (after some other request is performed), the servers sends a message to the browser via the websocket previously created
  1. Can be easily done with a route (as described in the documentation) and the websocket can be saved server side.

  2. But then how can I send data via the websocket ? (triggered server side)

This was easy to do with Play 2.5 with LegacyWebSocket.

Actually I am trying to perform what is described in this topic (Websocket, ActorFlow.actorRef vs Flow.fromSinkAndSourceMat with SourceQueue). I spent some time trying with the help of the JavaDoc but I still cannot figure it out.

Thank you