play-scala-websocket-example
play-scala-websocket-example copied to clipboard
What's the idea with the Broadcast Hub in UserActor?
Hi,
I'm trying to wrap my head around with the design of this example. One thing that is confusing me is the hubSource in UserActor. Why is it required that there is a fan-out mechanism here? I understand that sending stuff to the hubSink will propogate to the client via the websocketFlow, but I'm not sure what the requirement for the multiple consumers of the flow. Isn't UserActor created for each WebSocket connection via the UserParentActor? If so, who are the extra subscribers if they are not the users?
Thank you
It's so you can add stocks after the flow has started:
https://github.com/playframework/play-scala-websocket-example/blob/2.6.x/app/actors/UserActor.scala#L94