nestj/client/typescript
Hellings 3e104ded8d
Some checks are pending
Build and publish / verify (push) Waiting to run
Build and publish / publish (push) Blocked by required conditions
branch(main): Initial commit.
2026-09-12 08:20:46 -04:00
..
.gitignore branch(main): Initial commit. 2026-09-12 08:20:46 -04:00
browser.ts branch(main): Initial commit. 2026-09-12 08:20:46 -04:00
bun.lock branch(main): Initial commit. 2026-09-12 08:20:46 -04:00
index.ts branch(main): Initial commit. 2026-09-12 08:20:46 -04:00
node.ts branch(main): Initial commit. 2026-09-12 08:20:46 -04:00
package.json branch(main): Initial commit. 2026-09-12 08:20:46 -04:00
README.md branch(main): Initial commit. 2026-09-12 08:20:46 -04:00
tsconfig.json branch(main): Initial commit. 2026-09-12 08:20:46 -04:00
ws.d.ts branch(main): Initial commit. 2026-09-12 08:20:46 -04:00

NestJ TypeScript WebSocket client

The connector uses the plain WebSocket protocol, not Socket.IO.

import { createWebSocketClient } from "./index.js";
const socket = createWebSocketClient("ws://localhost:8080/chat");
socket.onMessage(console.log);
await socket.connect();
socket.send("hello");

Browser builds use the platform WebSocket. Node.js projects can import createNodeWebSocketClient from node.ts, which uses ws.