tubes-js
is a JavaScript client library to connect to a tubes
server. It provides a simple API to connect to WebSocket channels and send/receive messages.
Install the package using your preferred package manager:
pnpm add @go-tubes/tubes-js
import { TubesClient } from '@go-tubes/tubes-js';
// Initialize the client
const client = new TubesClient({ url: 'ws://localhost:8080', debugging: true });
// Connect to a channel
client.subscribeChannel("test", console.log);
client.send("test", { payload: { foo: "bar" } })