websocket-sharp icon indicating copy to clipboard operation
websocket-sharp copied to clipboard

send("message") inside onopen() always fail

Open hy-net opened this issue 3 years ago • 0 comments

Using javascript to invoke a WSSharp server

var ws = new WebSocket("ws://localhost:5002/test");
ws.onopen = function () {
	setTimeout(function () {
		ws.send("Hello");
	}, 1000);
};

The above code will fail if I do not wrap ws.send() with setTimeout()

hy-net avatar Mar 06 '22 21:03 hy-net