Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Package details:
"@microsoft/signalr": "^6.0.5",
"react": "^18.1.0",
I am using @microsoft/signalr with React for fetching real-time data.
and it is working as expected.
but the problem is it is log following errors into console. when my app first load and try to make connection first-time.
belove is image of that console.
and please note that my app is working fine and also signlr getting respose data.
my issue is why this error is generating and how to remove that errors logging into console.
here is my react code for initialize the signlr
useEffect(() => {
const tokenheaders = accessToken;
// define hub connection
const connect = new HubConnectionBuilder()
.withUrl(process.env.REACT_APP_SIGNALR_BASE_URL, {
accessTokenFactory: () => tokenheaders,
})
.withAutomaticReconnect()
.configureLogging(LogLevel.None)
.build();
// set hub connection
setHubConnection(connect);
if (userRoles.includes('Admin') || userRoles.includes('Reviewer')) {
setRole('reviewer');
}
}, [accessToken, ###userRoles]);
useEffect(() => {
if (hubConnection) {
// connection start
hubConnection.start();
// receiving method
hubConnection.on('RealTimeQuantityOfImage', (response) => {
const data = response;
if (data !== null) {
dispatch(setRealCount(data?.imagecount));
}
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [hubConnection]);
Expected Behavior
there should be no errors if connection successfully and receiving proper response.
Steps To Reproduce
please initialize connection as i have mentioned in details.
Exceptions (if any)
No response
.NET Version
.Net Version = .Net 5.0
Anything else?
in Backend they have used.
Microsoft.AspNetCore.SignalR.Core, Version=5.0.0.0
Quartz, Version=3.4.0.0
Npgsql.EntityFrameworkCore.PostgreSQL, Version=5.0.0.0