❔ ✅ asp.net websockets
Hi, i want to migrate my typescript webserver to c#.
I basically have a room-repositoy that has an instance of all open rooms, a room can be created via a rest enpoint (shouldnt be the problem).
The room has an id, and is its own websocketserver instance with the
no server option
. I dont really know how i can explain this further, the http-server
listened to upgrade request and got corresponding room object from the repository, from the url params like ws://localhost:8080/rooms/{roomID}
. The rooms handles the upgrade and the client sends messages to this instance. Is there a similar system like this or do i have to create one endpoint and match every message to the corresponding room. Thanks in advance8 Replies
if i understand what you want i have no idea if there is already a package that implements a chat room system, websocket won't do this for you; at most you could have a messaging system like rabbitmq that has queues and can handle that part for you
This meaning multiple websocket instances arent a thing in c#?
no no you can do what you want/need
k, i think im just gonna do lists and check the websocket id on every message to know where it should go bc i have 0 knowledge on messaging systems. Gonna keep it in the back of my mind tho.
@VeQox is there a reason you are avoiding using signalR?
SignalR hubs sound like they would work well for you. You can do websockets using an ASP.NET Core middleware, but as mentioned, you'd have to manage all the communication conventions over those sockets yourself:
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/websockets?view=aspnetcore-7.0
WebSockets support in ASP.NET Core
Learn how to get started with WebSockets in ASP.NET Core.
well mostly because bc id like to implement things myself (aka shooting myself in the foot), and bc a friend of mine wants to make an alternative server implementation, which would mean my client is incompatable bc its using the typescript sdk to connect to the hub
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.