zbrad / wsweb Goto Github PK
View Code? Open in Web Editor NEWAn minimal example of using WebSockets in ASP.NET Core
License: MIT License
An minimal example of using WebSockets in ASP.NET Core
License: MIT License
So in the example we have an echoloop, but how can we more realistically implement & pass a method & payload with the websocket which in turn calls a Web API controller let's say, and then returns that outgoing response from it.
Looking into it now, post when I get more info and/or get it working!
Hi, I wrote a small test .net core console program. I generate about 5k client websocket and connect to the web server , about 2 minutes later, I call CloseAsync method from client websocket and this web server deals with the WebSocketMessageType.Close information and call WebSocket.Dispose() to clear the resources that websocket holds, however, I found that this dotnet.exe still holds about 300M memory space. I run this web server from donnet command window using command lines, and the operating system is Windows 10. I feel confused and do not know how to do. The code is down below
class Program
{
static void Main(string[] args)
{
List<ClientWebSocket> sockets = new List<ClientWebSocket>();
Uri ServerUri = new Uri("ws://localhost:5000/ws");
for (int i = 0; i < 5000; i++)
{
ClientWebSocket cs = new ClientWebSocket();
sockets.Add(cs);
cs.ConnectAsync(ServerUri, CancellationToken.None);
}
Console.WriteLine("All Connected");
Thread.Sleep(2 * 60 * 1000);
Console.WriteLine("Begin to disconnect");
for (int i = 0; i < 5000; i++)
{
sockets[i].CloseAsync(WebSocketCloseStatus.NormalClosure, "closed by client", CancellationToken.None);
}
Console.ReadLine();
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.