Azure SignalR Service
An Azure service that is used for adding real-time communications to web applications.
147 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How to configure signal R to send requests to KONG API with bearer token. I am able to get connection token from negotiate version but not able to maintain the connection. I am passing headers as web socket but it's still not able to keep the connection alive.
My UI code
useEffect(() => {
let header = {
'Authorization': "Bearer " + token,
connection: 'Upgrade',
host: 'my-websocket-api.com',
upgrade: 'WebSocket'
}
// Establish the connection to the SignalR hub
const newConnection = new HubConnectionBuilder()
.withUrl(GET_SIGNALR_ENDPOINT_Secured, {
transport: HttpTransportType.ServerSentEvents,
withCredentials: false,
transport: HttpTransportType.ServerSentEvents,
accessTokenFactory: () => { return userSession?.dispensingToken },
**headers: header,**
httpClient: new CustomHttpClient(),
})
.build();
setConnection(newConnection);
}, []);
useEffect(() => {
if (connection) {
connection.start()
.then(() => {
console.log('Connected to the hub');
});
setIsHubConnected(true);
})
.catch(err => console.error('Connection failed: ', err));
}
}, [connection]);