Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is websocket-sharp very slow? #739

Open
barpas opened this issue Nov 14, 2023 · 3 comments
Open

is websocket-sharp very slow? #739

barpas opened this issue Nov 14, 2023 · 3 comments

Comments

@barpas
Copy link

barpas commented Nov 14, 2023

hi (sory my english)
i made some test: i connect to chrome dev tools listening on port 9222 by two dll's - websocketsharp and websocket4net - both ask chrome the same questions and get the same answers but websocket4net use 1,6 second for complete all tests and websocketsharp 25s !!!
any idea what may be a problem ?

public string SendCmd(string cmd)
{
	string message = "";
	using (var ws = new WebSocketSharp.WebSocket(this.sessionWSEndpoint))
	{
		ws.OnMessage += (sender, e) =>
		{
			message = e.Data;
		};
		ws.OnError += (sender, e) =>
		{
			message = e.Message;
		};
		ws.OnOpen += (sender, e) =>
		
			ws.Send(cmd);

		ws.OnClose += (sender, e) =>
		{
			//message = string.Format("code {0},reason {1}", e.Code, e.Reason);
		};
		ws.Connect();
		while (message == "")
		{
			System.Threading.Thread.Sleep(10);
		}
	}
	return message;
}
@HajiyevEl
Copy link

@barpas have you found the reason?

@barpas
Copy link
Author

barpas commented Dec 2, 2023

sory i wrote own implementation, very simple but a bit faster that websocket4net

@HydraOrc
Copy link

Yes, this library is in fact slow and most likely outdated. I had issues running the server with mono, was able to only handle a very low and very random number of clients, sometimes 12, sometimes 28, sometimes 47, sometimes 77.
So I had to replace this with another server solution, specifically vtorola.websockets, it can handle 350 connections with no problems now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants