Basically you can provide a custom HttpClient to the hubConnecitonBuilder which allows you do whatever you want with the signalR requests, it can be very interesting for the negotiation part which was behind an azure APIManagement for me:
let options: IHttpConnectionOptions = {
httpClient: <HttpClientSignalR>{
getCookieString: (url) => {
return '';
},
post: (url, httpOptions) => {
return this.http.post(url, null, {
headers: httpOptions.headers,
withCredentials: false
})
.toPromise()
.then(
res => {
return {
statusCode: 200,
statusText: null,
content: JSON.stringify(res)
};
},
err => err
);
}
}
}
this._hubConnection = new HubConnectionBuilder()
.withUrl(environment.host_url + this.routes.notification + '?userId=' + userId, options)
.build();
In my case, my custom headers (invisible here) are added by my angular app http interceptors which can now intercept the @aspnet/signalr http requests and add proper headers, as I m using my app HttpClient to emit my request instead of the library one.