Adding an http header to a WebSocket request

Hi,

Currently, we are adding an auth header to all of our requests by specifying a prerequest in our data services as such:

  const preRequest = endpoint => {
    if (window.token) {
      endpoint.headers.authorization = `Bearer ${window.token}`;
    }
    return endpoint;
  };

Is there an equivalent for WebSocketDataChangeEventManager? So far I do not see a way to do this, but we will need some way to append an auth token.

Thanks

edit: this is on leaf js 3.1.0

We don’t provide a way to pass headers. According to this stackoverflow thread the native WebSocket class does not have an api for it either. The thread did talk about some possible ways to handle authorization.

1 Like

That’s unfortunate. thanks for the response though!