()
| 362 | } |
| 363 | |
| 364 | function close() { |
| 365 | if (websocket) { |
| 366 | if ((websocket.readyState === WebSocket.OPEN) || |
| 367 | (websocket.readyState === WebSocket.CONNECTING)) { |
| 368 | Util.Info("Closing WebSocket connection"); |
| 369 | websocket.close(); |
| 370 | } |
| 371 | websocket.onmessage = function (e) { return; }; |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | // Override internal functions for testing |
| 376 | // Takes a send function, returns reference to recv function |