I would like to implement a websockets server with asp.net core. At the moment it seems that you have 2 different packages for this:
I have the following questions:
WebSockets support in ASP.NET Core. This article explains how to get started with WebSockets in ASP.NET Core. WebSocket (RFC 6455) is a protocol that enables two-way persistent communication channels over TCP connections. It's used in apps that benefit from fast, real-time communication, such as chat, dashboard, and game apps.
The code of client just uses the sample in the document of ASP.NET Core WebSocket. Here is the source code you can find in my GitHub page. This article showed you a sample that uses WebSocket to build a real-time application via ASP.NET Core.
This collection ( websocketConnections) contains all websockets for clients that have connected to our backend. When we add a socket to the collection we also add an Id so that it is easier to keep track of all the websockets and who is sending messages. We then send a message to all current websockets that we have a new client who joined the chat.
When we call new WebSocket (url) , it starts connecting immediately. During the connection client asks the server: “Do you support Websocket?” And if the server replies “yes”, then the talk continues in WebSocket protocol. Browser header request made by new WebSocket (url) as shown below:
Websockets tutorial
SignalR Tutorial
As for maturity, I guess this is the best you can get at the moment.
I think you want to use Microsoft.AspNetCore.WebSockets. You can find some samples in the repo: https://github.com/aspnet/WebSockets
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With