Error during Websocket Handshake - Bug Fix for a React App with SignalR

Опубликовано: 15 Октябрь 2024
на канале: Round The Code
17,146
37

I integrated SignalR with my React app and found that sometimes the SignalR connection worked, and sometimes it didn't.

I was unable establish a connection between my React app and SignalR on a regular basis. I was getting the following error in my browser's development tools:

WebSocket connection to 'ws://localhost:44357/sockjs-node' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET

In this video, I will show you how the React app is trying to use WebSocket to connect to the WebpackDevServer and that it was using the non-secure ws protocol when trying to establish this WebSocket connection.

In addition, I will also show you how I went about using the secure wss protocol when using the WebSocket connection to resolve this issue.

📖 Learn .NET and C# with our online courses 📖
https://www.roundthecode.com/dotnet-c...

► More Information: https://www.roundthecode.com/dotnet-t...

#react #signalr