0.45.4 • Published 9m ago
@meshagent/meshagent-node
Licence
Apache-2.0
Version
0.45.4
Deps
0
Size
32 kB
Vulns
0
Weekly
0
MeshAgent Node TypeScript
Node.js helpers for MeshAgent TypeScript applications.
Room websocket proxy
attachRoomWebSocketProxy attaches a raw websocket upgrade tunnel to a Node HTTP server. By default it listens on /.well-known/meshagent/room/connect, reads the room websocket target from MESHAGENT_ROOM_WEBSOCKET_URL or derives it from MESHAGENT_API_URL/MESHAGENT_PROFILE_API_URL and MESHAGENT_ROOM, and forwards the upgrade with Authorization: Bearer $MESHAGENT_TOKEN.
import { createServer } from "node:http";
import { attachRoomWebSocketProxy } from "@meshagent/meshagent-node";
const server = createServer(app);
attachRoomWebSocketProxy(server);