How to propagate errors to browser websocket client from akka-http?

Hi,
I am using akka-http with webosockets to stream data to browser. I am using the handleWebSocketMessages directive. It worked perfectly fine until I had the requirement to send different kind of errors.

I was wondering if there is any way in akka-http to close the websocket stream with some “reason” or “error message” so I could get handle of it in websocket.onClose or websocket.onError hook in the browser.

1 Like