I am trying to set up signalr with react js and trying to receive value from backend (asp.net), my code are following
const signalR = require("@aspnet/signalr");
useEffect(() => {
const createHubConnection = async () => {
const hubConnect = new signalR.HubConnectionBuilder()
.withUrl("http://82../notificationhub")
.configureLogging(signalR.LogLevel.Information)
.build();
try {
await hubConnect.start();
} catch (err) {
alert(err);
}
};
createHubConnection();
}, []);
hubConnect.start() is not working and and I am getting CORS error Access to XMLHttpRequest at 'http://82../notificationhub/negotiate' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
package version in package.json,
"@aspnet/signalr": "^1.1.4",
Full error message
Is there anything from client side I can do ?
