Open nex3 opened 8 years ago
I can confirm. Moreover, WebSocket.readyState
always returns WebSocket.OPEN
. https://github.com/dart-lang/sdk/issues/32876
I can confirm as well. I have just stumbled upon it while testing how my Android Flutter app behaves after turning on and off the airplane mode. The socket becomes unusable with no indication of the problem. As mentioned, even the readyState
is OPEN
.
Actually, my case described above seems to be resolved by reacting to ws.done
. I can re-establish the connection then after an offline period.
If a WebSocket client's connection is closed by the server after its subscription has been canceled, it's still able to send messages. I haven't read the spec or examined the protocol-level interactions in detail, but this seems wrong.
What's more, Dart's WebSocket server will also receive this message—despite having called both
WebSocket.close()
andHttpServer.close()
. This is clearly wrong, since the documentation ofWebSocket.close()
says that it "closes the WebSocket connection".Here's a reproduction:
I reproduced this as of 77101d63e3c661957b7829dd96d6b4324da0e768.
I'd expect the socket to continue listening to the server behind-the-scenes even after the subscription is cancelled, so that it can determine when the connection is closed.