13547: Merge branch 'master' into 13547-respect-insecure-flag-when-talking-ssl-to...
[arvados.git] / apps / workbench / test / support / fake_websocket.js
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 sockets = [];
6 window.WebSocket = function(url) {
7     sockets.push(this);
8     window.setTimeout(function() {
9         sockets.map(function(s) {
10             s.onopen();
11         });
12         sockets.splice(0);
13     }, 1);
14 }
15
16 window.WebSocket.prototype.send = function(msg) {
17     // Uncomment for debugging:
18     // console.log("fake WebSocket: send: "+msg);
19 }