Giter Site home page Giter Site logo

wsweb's Introduction

wsweb's People

Contributors

zbrad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

wsweb's Issues

I feel like that there is something wrong with the memory leak problem?

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();
        }
    }

Calling Web API Controller from WS?

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.