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

ricea commented on this pull request.



> @@ -4231,6 +4231,7 @@ promises returned by its <a lt="writable stream writer">writer</a>'s {{WritableS
     return new WritableStream({
       start(controller) {
         ws.onerror = () => controller.error(new Error("The WebSocket errored!"));
+        ws.onclose = () => controller.error(new Error("The server closed the connection unexpectedly!"));

If for example the remote server closes the connection abruptly, then onerror and onclose will both fire.

I don't actually know of a case where onerror fires without onclose also firing. Certainly Chrome's implementation never does it. So one way of simplifying this would just be to not set an onerror handler.

-- 
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#pullrequestreview-29423978

Received on Tuesday, 28 March 2017 11:36:21 UTC