I'm using @aspnet/signalr Official Javascript client from This npm package
I wondering if there is the way to add Header configuration to the client connection header
How I build the connection
let connection = new signalR.HubConnectionBuilder()
.withUrl(
"https://some.signalr-host.com"
)
.build();
The definition for IHttpConnectionOptions got a headers property in early 2020. (It's not visible on the documentation website, but is in the Typescript definition files.) You can now do as follows:
const connection = new signalR.HubConnectionBuilder()
.withUrl("https://some.signalr-host.com", {
headers: {"foo": "bar"}
})
.build();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With