diff options
author | 2023-01-27 14:22:03 -0800 | |
---|---|---|
committer | 2023-01-27 14:22:03 -0800 | |
commit | 41af4b43e2b0280dad4ef51aea3ec465c3051889 (patch) | |
tree | c4fb3a3efeb07bc26df47bd74a264afb3a489f9d /test/bun.js/websocket-subprocess.ts | |
parent | c1d05cf623694262c20449a98103ee3ee02eea40 (diff) | |
download | bun-41af4b43e2b0280dad4ef51aea3ec465c3051889.tar.gz bun-41af4b43e2b0280dad4ef51aea3ec465c3051889.tar.zst bun-41af4b43e2b0280dad4ef51aea3ec465c3051889.zip |
more websocket ref/deref tests
Diffstat (limited to 'test/bun.js/websocket-subprocess.ts')
-rw-r--r-- | test/bun.js/websocket-subprocess.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/bun.js/websocket-subprocess.ts b/test/bun.js/websocket-subprocess.ts index 4700f75b7..cf64f18ef 100644 --- a/test/bun.js/websocket-subprocess.ts +++ b/test/bun.js/websocket-subprocess.ts @@ -1,12 +1,13 @@ -const hostname = process.argv[2]; -const port = process.argv[3]; - -const host = port ? `http://${hostname}:${port}` : hostname; +const host = process.argv[2]; const ws = new WebSocket(host); ws.onmessage = (message) => { - if (message.data == "hello websocket") { + if (message.data === "hello websocket") { ws.send("hello"); + } else if (message.data === "timeout") { + setTimeout(() => { + ws.send("close"); + }, 300); } }; |