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

**URL:** <https://discuss.akka.io/t/how-to-propagate-errors-to-browser-websocket-client-from-akka-http/4878>\
**Category:** Akka HTTP\
**Tags:** akka, akka-http, websockets\
**Created:** [August 19, 2019, 9:31am UTC](https://discuss.akka.io/t/how-to-propagate-errors-to-browser-websocket-client-from-akka-http/4878 "2019-08-19T09:31:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bilal-fazlani](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/bilal-fazlani/32/1506_2.png) [@bilal-fazlani](https://discuss.akka.io/u/bilal-fazlani)\
**Post date:** [August 19, 2019, 9:31am UTC](https://discuss.akka.io/t/how-to-propagate-errors-to-browser-websocket-client-from-akka-http/4878/1 "2019-08-19T09:31:04Z")

</div>

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.
