C
C#12mo 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
boiled goose
boiled goose12mo 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
VeQox12mo ago
This meaning multiple websocket instances arent a thing in c#?
boiled goose
boiled goose12mo ago
no no you can do what you want/need
VeQox
VeQox12mo 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
IsNotNull12mo ago
@VeQox is there a reason you are avoiding using signalR?
IsNotNull
IsNotNull12mo 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
VeQox12mo 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
Accord12mo 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
More Posts
How to make .EpubI want to make .epub from .html or if somobody will recomend some free library to make epub.What control should I use?I want to create a "feature search" command palette for my WPF application (like the one in Visual S✅ Build and Deploy 2 projects from the same solution with GitHub Actions to different web appsHas anyone had experience building and deploying 2 projects from the same solution with GitHub Actio✅ Seeking Suggestions: Efficient and Reliable Real-time Data Update for Thousands of Web ClientsI have an API developed in .NET and several thousand web application clients. Whenever a change occu❔ Need to delete all the Cloned Prefabshow would I fix this code so it deletes all cloned fish prefabs if their Float(thisLength) is smalleUnity id has been expiredThe problem is that whenever I want to sign in in my Unity Learn Account in browser it says that Uni❔ Microsoft.AspNetCore.Http.Features deprecated how to use IFormFileCollection?I'm at .NET 7 but `Microsoft.AspNetCore.Http.Features` is deprecated how to use `IFormFileCollectionNeed help with changing the value of a object without self referenceI need the funcation in MenuButtonsViewModel to set the value of CurrentView.View and when CurrentVi✅ Making games linux friendlyI play various games off the Steam launcher and they all seem to be primarily windows OS based games❔ Download picture from button.I'm trying to create a download button. For example when you click the button, obviously, the photo