mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +00:00
14 lines
268 B
TypeScript
14 lines
268 B
TypeScript
const host = process.argv[2];
|
|
|
|
const ws = new WebSocket(host);
|
|
|
|
ws.onmessage = message => {
|
|
if (message.data === "hello websocket") {
|
|
ws.send("hello");
|
|
} else if (message.data === "timeout") {
|
|
setTimeout(() => {
|
|
ws.send("close");
|
|
}, 300);
|
|
}
|
|
};
|