Re: [whatwg/streams] Update WebSocket examples (#713)

ricea commented on this pull request.



>      });
+
+    function closeWS(code, reasonString) {
+      return new Promise((resolve, reject) => {
+        ws.onclose = e => {

So "fail the WebSocket connection" points you to here https://tools.ietf.org/html/rfc6455#section-7.1.7 which tells you that the first thing we do it close the connection. Which then causes onclose to fire.

It might be that an implementation fires onerror much sooner than onclose, but Chrome doesn't do that. In fact, we tear down the connection synchronously when we detect a failure condition:

https://cs.chromium.org/chromium/src/net/websockets/websocket_channel.cc?q=%22Careful+study+of+RFC6455%22

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/713#discussion_r108398527

Received on Tuesday, 28 March 2017 11:44:22 UTC