Home > Net >  ASP. NET Core how to create multiple WebSocket connection?
ASP. NET Core how to create multiple WebSocket connection?

Time:01-01

Recently started using ASP. NET Core,
Need to create a three WebSocket connections on the server,
Or called need three different channel of the attachment to the difference between different sources,

Reference for making many Internet resources is as follows:
https://gitee.com/ikende/BeetleX (this seems to be not built with native Kestrel WebServer, don't know can like middleware into pipeline)
https://www.google.com.tw/amp/s/codingnote.cc/zh-tw/p/124183/amp/really seldom useful ASP. NET Core (pipeline) to establish a multi-channel WebSocket example,

At present mainly refer to the following article set up?
https://radu-matei.com/blog/aspnet-core-websockets-middleware/

But only support multi-channel, don't know will simply write performance is very poor,
Version would like to invite friends to recommend high concurrency and support channel open source or provide more design of multi-channel, thanks:)

CodePudding user response:

??
Normally we do not choose three, we will only write routing, write the hub, message processing

I'm too lazy to find information to search a
https://blog.csdn.net/sD7O95O/article/details/94415540

Ps: you knew about the channel, but also care about the original is a few? If I visit is ws://XXXXXXXX/channel1 do you think?

CodePudding user response:

As for performance, basically I can only say "watch less blog garden" -- -- -- -- -- -- -- to see, the more the more you can't write code

The current blog garden already compromised by other languages? According to, because is the wave of killings, all day long string to drop performance, let blog garden neter nausea, let themselves within the volume, the real neter still need to respect the reality, with less "attack" -- -- -- -- -- -- -- -- those who write killings, to not attack, it is because they don't respect their actual, now that don't respect the actual, must deliberately flying dun land, then dashed is normal

CodePudding user response:

See article essence logic

You
https://radu-matei.com/blog/aspnet-core-websockets-middleware/
Itself said
App. MapWebSocketManager ("/ws ", serviceProvider. GetService ());

So we say, since have/ws can have/ws1,/ws2

Now that have NotificationsMessageHandler can have NotificationsMessageHandler 1, NotificationsMessageHandler 2


So want to understand the somebody else than attack to all day with the garden, and the string to be meaningful

CodePudding user response:

reference 1st floor wanghui0380 response:
??
Normally we do not choose three, we will only write routing, write the hub, message processing

I'm too lazy to find information to search a
https://blog.csdn.net/sD7O95O/article/details/94415540

Ps: you knew about the channel, but also care about the original is a few? If I visit is ws://XXXXXXXX/channel1 do you think?
I see online SignalR example usage is to write the Hub,
Originally the WebSocket also can?

In addition to my current reference example,
Because ConnectionManager is built into AddTransient, seems to me as long as the other to create a similar ChatMessageHandler category, and in the Startup. Cs map within it (below), it is ok to @ @?

App. MapWebSocketManager ("/ws ", serviceProvider. GetService ());

CodePudding user response:

See a problem, see nature
App. MapWebSocketManager ("/ws ", serviceProvider. GetService ());
App. MapWebSocketManager ("/ws1, "serviceProvider. GetService
This is can

Same question, look at what nature Kestrel, Kestrel essentially just a sokect server, just the built-in HTTP, ws protocol parsing, and they Shared the same port,
So, in essence, he is 1, the default is 1, no more than what you say, he is only one, all of your access only through a resolution path, a pipeline, a map route allocation,
General he has never been more, now that is sokect server, of course we know, is essentially open a listening, even on a is a channel based on the socket, so he is no more than one essentially the

Said in the back, what do you want the so-called performance, performance, how to, everybody is through a port, a pipeline, a route, so you feel so many public a performance is not high??


Well, I lost you, you want more, you can, then we open multiple ports for

O.L istenAnyIP (1883, l=& gt; l.U seMyWebSockect ());
O.L istenAnyIP (1884, l=& gt; l.U seMyWebSockect ());

Yes, we can write a UseMyWebSockect connection extension, tell him 1883188 4 listening alone, and use MyWebSockect processing, so that you can meet your requirement, don't talk to others the same resource utility,

Just my personal said, basic don't need to

CodePudding user response:

The
reference 3 floor wanghui0380 response:
see article essential logical

You
https://radu-matei.com/blog/aspnet-core-websockets-middleware/
Itself said
App. MapWebSocketManager ("/ws ", serviceProvider. GetService ());

So we say, since have/ws can have/ws1,/ws2

Now that have NotificationsMessageHandler can have NotificationsMessageHandler 1, NotificationsMessageHandler 2


So want to understand the somebody else than attack to all day with the garden, and the string to be meaningful


Thank you for your reply, send the article above, using a mobile phone, also didn't see your reply other updates, so would the hair surface,
I wait to give it a try ~ ~ ~ thank you:)

CodePudding user response:

UseKestrel (o=& gt;
{
O.L istenAnyIP (1883, l=& gt; L.U seMyWebSockect ());
O.L istenAnyIP (1884, l=& gt; L.U seMyWebSockect ())

})

CodePudding user response:

reference 5 floor wanghui0380 reply:
see problems, see nature
App. MapWebSocketManager ("/ws ", serviceProvider. GetService ());
App. MapWebSocketManager ("/ws1, "serviceProvider. GetService
This is can

Same question, look at what nature Kestrel, Kestrel essentially just a sokect server, just the built-in HTTP, ws protocol parsing, and they Shared the same port,
So, in essence, he is 1, the default is 1, no more than what you say, he is only one, all of your access only through a resolution path, a pipeline, a map route allocation,
General he has never been more, now that is sokect server, of course we know, is essentially open a listening, even on a is a channel based on the socket, so he is no more than one essentially the

Said in the back, what do you want the so-called performance, performance, how to, everybody is through a port, a pipeline, a route, so you feel so many public a performance is not high??


Well, I lost you, you want more, you can, then we open multiple ports for

O.L istenAnyIP (1883, l=& gt; l.U seMyWebSockect ());
O.L istenAnyIP (1884, l=& gt; l.U seMyWebSockect ());

Yes, we can write a UseMyWebSockect connection extension, tell him 1883188 4 listening alone, and use MyWebSockect processing, so that you can meet your requirement, don't talk to others the same resource utility,

Just my personal said, basic it is not necessary to


nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related