This project is code for the blog post ASP.NET SignalR and React.
Please read the post to understand what the code is intended to demonstrate.
You need .NET 7.0 and Node.JS 20 (and npm) to run this sample.
If you want to start your repo based on this setup, please click here.
You need to run the front end and backend separately.
- Navigate to the backend folder.
- Option 1: Open the project file in Visual Studio and run the project.
Option 2: Open a command line (ex. Git Bash) and run
dotnet run
.
The app runs in development mode. Open https://localhost:5001/swagger/index.html to view it in the browser.
We are not using the SayHello API, but you can see that your app is up and running. The SignalR hub is available on https://localhost:5001/hub. You will receive a "Connection ID required" message if you try to access it through the browser.
- Navigate to the frontend folder.
- Run
npm ci
to get the dependencies. - Run
npm start
.
The app runs in development mode. Open http://localhost:3000 to view it in the browser.
Open multiple browser windows on http://localhost:3000, You see as you press the button (on any of instances) all pages get updated.