import WebSocket from "ws"; import { Decoder } from "cbor-x"; if (process.argv.length < 3) { console.log('Usage: node consumer.js ws://localhost:3333/'); process.exit(1); } const decoder = new Decoder({ mapsAsObjects: true }); const ws = new WebSocket( new URL("/xrpc/com.atproto.label.subscribeLabels", process.argv[2]).toString() ); ws.on("message", (data) => { const buffer = Buffer.from(data); const results = decoder.decodeMultiple(buffer); for (let result of results) { console.log(result) } });