This project shows a simple and rudamentary example of using a POST API to interact with a websocket.
It also uses JWT validation for protecting the routes and the websocket.
For Dotnet Core:
dotnet restore
For signalr javascript client:
cd wwwroot
npm install
dotnet run
The default run will opeen a document in your browser that should connect to the socket by default.
(If not, visit http://localhost:5000)
Two things you can then do:
- Authenticate:
POST http://localhost:5000/token username/password
- Use the token to send a message:
Add 'Authorization: Bearer {token}' header
POST http://localhost:5000/messages/share message
- Observe signalr winning