OLD | NEW |
---|---|
(Empty) | |
1 var ws = new WebSocket("ws://127.0.0.1:8880/echo"); | |
2 var errorCalled = false; | |
3 ws.onopen = function () { | |
4 postMessage("FAIL: Unexpected open event on ws"); | |
5 }; | |
6 ws.onmessage = function () { | |
7 postMessage("FAIL: Unexpected message event on ws"); | |
8 }; | |
9 ws.onerror = function () { | |
10 errorCalled = true; | |
11 }; | |
12 ws.onclose = function () { | |
13 if (errorCalled) | |
14 postMessage("DONE"); | |
15 else | |
16 postMessage("FAIL: Error event was not dispatched"); | |
17 }; | |
18 ws.close(); | |
OLD | NEW |