You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Not sure this is a bug, but I can't find a good way to implement full duplex protocol using websocket. Examples I see are half duplex - request/response.
Let's say I want to stream some random data to a client (stock price for example). On the top of it I need regular request/response protocol.
val myStream : ZStream[Any, Throwable, String] = ??? //source of some random data
val socketApp: WebSocketApp[Any] =
Handler.webSocket {
channel =>
channel.receiveAll {
case ChannelEvent.Read(WebSocketFrame.Binary(bytes)) =>
decode(bytes) match {
case MyCustomCommand() =>
channel.send(Read(WebSocketFrame.binary(myResponse)))
case Subscribe() =>
// I have to start streaming random data
myStream.run(ZSink.foreach(x => channel.send(Read.WebSocketFrame.binary(encode(x))))
//after this message I never get MyCustomCommand(), which makes sense because myStream is never ending
}
}
}
Describe the bug
Not sure this is a bug, but I can't find a good way to implement full duplex protocol using websocket. Examples I see are half duplex - request/response.
Let's say I want to stream some random data to a client (stock price for example). On the top of it I need regular request/response protocol.
I can fork
It seems to be working, but I'm not sure if it is the right way to do. The resource leak is my concern.
The text was updated successfully, but these errors were encountered: