Websocket - c# . NET

Asked

Viewed 973 times

4

I found almost nothing about Websockets + . NET on google, I would like to know how this server is made using the . NET in the future the idea is to create an application and hardware (Arduino) that communicates with this Websocket server. Is it possible to create a Websocket server in Consoleaplication or Servicewindows? or only in Asp.net (web page)? how is this server created? Javascript? or can you do it using C# ? I’ve done a lot of research, but it’s still a little vague on the logic of Websocket, so if anyone can share a simple code just to really understand how Websocket works, I’d appreciate it very much!

  • https://stackoverflow.com/a/30524243/4713574

  • But in this case he’s a client, I want to be the host

  • To be the host just create the Websocket connection and access by the same address you are using to access your site, only changing the type of http access by Ws or wss (if it is secure connection) no need to make host settings the ports are released according to what you define in your source c#

3 answers

2

You can run the server on the console if you use Asp net core (including linux). The ideal is to write using the signaler (module npm) to make your life easier, allowing you to implement the web socket without having much knowledge. To run the server on the console just run the dotnet run command in the project folder or play in the visual studio using the console option, I don’t remember the name but you will see two, one using IIS Express and the other the console. To learn more about signalr visit the tutorial (in English) https://dotnetthoughts.net/getting-started-with-signalr-using-aspnet-core/

1

The Signalr par Amim today is the best solution dem websocket c#.

I think it’s worth studying a little bit about him.

I use in some applications of mine, it is very simple to make and manage the connections.

You can choose to connect to all users, a user or a user group.

This tutorial of Eduardo Pires helped me a lot: http://www.eduardopires.net.br/2013/04/aspnet-signalr-introducao-e-utilizacao/

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.