Hi all,
i would like to keep multiple websocket client connections, and for each connection i will later send message, what would be the right way of implementing it?
i have actors sharded, and in each of them, i have a websocket connection, like bellow
val request = WebSocketRequest()
val websocketFlow = Http()(classicSystem).webSocketClientFlow(request)
val (((queue, upgradeResponse)), closed) =
Source.queue[TextMessage](bufferSize = 10, OverflowStrategy.backpressure)
.viaMat(websocketFlow)(Keep.both)
.toMat(incoming)(Keep.both)
.run()(materializer)
And i am using later
queue.offer()
to send new message
It works when there is one connection, however whenever i start a new connection (on another actor sharded), the first actor’s queue just closes
1 post - 1 participant