diff options
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); } }; |