aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/websocket-subprocess.ts
blob: 4700f75b7527bf6720fbfb024afca0a7e519079b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
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");
  }
};