How to identify a connected logged in user in a browser uniquely, with EventSource for publishing the stream

Using playframework 2.5 with EventSource to publish events to a stream connected to a browser client. withConnected method is deprecated in 2.5, how to uniquely identify a connection and publish data only to the client to which it is connected without having to broadcast the same notification to all connected clients.

There’s a websocket example that shows how to send messages to a specific UserActor. The same streaming is used for EventSource and another example is here