Thuum Playground
Wire Broker
Publish events, set states and subscribe, live. Every frame sent and received, and the code that does it, in @thuum/client, plain browser JavaScript and Node.js.
Wire Broker: connecting…
Publish a message: it is delivered to whoever is subscribed to the topic or to one of its super topics right now, then it's gone. Nothing is stored. Needs P. pub
Ctrl+Enter or ⌘+Enter in a field
Result
Run an action to see its reply here.
Subscribed
Not subscribed to anything.
import { ThuumClient } from '@thuum/client';
// Your server's token route: it keeps the App Key, the browser gets a short-lived token.
const { token } = await fetch('/playground/wire/4yfgmx5q9g/token').then((r) => r.json());
const thuum = new ThuumClient({ baseUrl: 'https://api.thuum.dev' });
const socket = thuum.domain('thuum', token).wireBroker.connect();
await socket.ready;
// Delivered to whoever is subscribed right now; nothing is stored.
const { id, ts } = await socket.pub('playground:4yfgmx5q9g', 'reading', { "temperature": 21.5 });Runs in the browser. The token route belongs to your server, which keeps the App Key.
Anyone with this page's link can see and change this sandbox, and its data expires on its own. Don't put anything private here.