Everything work well but I find no documentation about closing the websocket. In ZIO-HTTP, Channel#shutdown (note it’s different from ZIO’s ZChannel) is used to close a socket but as far as I know I only have access to a zio.stream.Stream[Throwable, ClientMessage].
How can I close the websocket when a specific message is received?
The documentation doesn’t mention it, but I found that if your output stream is Stream[Throwable, Option[ServerMessage]] then when you return a None in the stream it will close the websocket from the server end. As long as you keep returning Some(message) then the socket will stay open.
Similarly, if the input stream has type Stream[Throwable, Option[ClientMessage]] then your controller logic will receive a None if the websocket is closed from the client end.