title: Ngxs + WebSocket | How to intercept the connection and add custom HTTP header?
body: <p>I'm using <a href="https://github.com/ngxs/store" rel="nofollow noreferrer">ngxs</a>' <code>NgxsWebsocketPluginModule</code> to create a websocket from within my Angular application. To authenticate the connecting client my server requires an authentication token to be present in the HTTP headers of the HTTP connection that gets upgraded to a websocket. Since the websocket example of the <a href="https://ngxs.gitbook.io/ngxs/plugins/web-socket" rel="nofollow noreferrer">ngxs documentation</a> only explain how to connect, send and receive messages via the websocket I'm looking for an example how to write an interceptor for this web socket connection in order to attach custom HTTP header.</p>