jchristn/WatsonWebsocket

An operation was attempted on a nonexistent network connection

Closed this issue · 2 comments

pha3z commented

When I navigate Chromium to a different page--thereby terminating existing socket connection that I've made to server-- the server throws this exception:
An operation was attempted on a nonexistent network connection

This exception occurs before the ClientDisconnected() event fires. The ClientDisconnected event fires and behaves as normal. The server also continues to run as normal.

Thanks @pha3z - will investigate this one too. Been doing a lot of stop/dispose synchronization in other libraries to make sure they tear down gracefully and will do the same here!

Hi @pha3z I'm trying to reproduce this one - I opened a Chrome tab and opened the Inspector to the console, and used this:

let socket = new WebSocket("ws://localhost:9000/");
socket.onopen = function () { console.log("success"); };
socket.onmessage = function (msg) { console.log(msg.data); };
socket.onclose = function () { console.log("closed"); };

After it connected, I sent some data:

socket.send("foo");

(which was received by the server)

I then navigated away to another page (using the URL bar) and it appears to have disconnected gracefully. Are you still encountering this?

Cheers, Joel