C
C#17mo ago
VeQox

❔ ✅ 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-serverlistened 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 advance
8 Replies
Omnissiah
Omnissiah17mo ago
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
VeQox
VeQoxOP17mo ago
This meaning multiple websocket instances arent a thing in c#?
Omnissiah
Omnissiah17mo ago
no no you can do what you want/need
VeQox
VeQoxOP17mo ago
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.
IsNotNull
IsNotNull17mo ago
@VeQox is there a reason you are avoiding using signalR?
IsNotNull
IsNotNull17mo ago
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.
VeQox
VeQoxOP17mo ago
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
Accord
Accord16mo ago
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.
Want results from more Discord servers?
Add your server