aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/websocket-subprocess.ts
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-01-26 18:26:05 -0800
committerGravatar GitHub <noreply@github.com> 2023-01-26 18:26:05 -0800
commit44c6ce11c4cdf160caf445da64f52019ed810073 (patch)
tree6dfafe8155e562ab480094717ed89a4da39d7a24 /test/bun.js/websocket-subprocess.ts
parentb32b0b87369c16e98c3402abb1d7ffd54c835f34 (diff)
downloadbun-44c6ce11c4cdf160caf445da64f52019ed810073.tar.gz
bun-44c6ce11c4cdf160caf445da64f52019ed810073.tar.zst
bun-44c6ce11c4cdf160caf445da64f52019ed810073.zip
fix websocket hang (#1910)
* ref and deref, and some tests * subprocess file * remove deref * use flag in test
Diffstat (limited to 'test/bun.js/websocket-subprocess.ts')
-rw-r--r--test/bun.js/websocket-subprocess.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/bun.js/websocket-subprocess.ts b/test/bun.js/websocket-subprocess.ts
new file mode 100644
index 000000000..4700f75b7
--- /dev/null
+++ b/test/bun.js/websocket-subprocess.ts
@@ -0,0 +1,12 @@
+const hostname = process.argv[2];
+const port = process.argv[3];
+
+const host = port ? `http://${hostname}:${port}` : hostname;
+
+const ws = new WebSocket(host);
+
+ws.onmessage = (message) => {
+ if (message.data == "hello websocket") {
+ ws.send("hello");
+ }
+};