this string has no description
0
consumer.js
1import WebSocket from "ws";
2import { Decoder } from "cbor-x";
3
4if (process.argv.length < 3) {
5 console.log('Usage: node consumer.js ws://localhost:3333/');
6 process.exit(1);
7}
8
9const decoder = new Decoder({ mapsAsObjects: true });
10const ws = new WebSocket(
11 new URL("/xrpc/com.atproto.label.subscribeLabels", process.argv[2]).toString()
12);
13
14ws.on("message", (data) => {
15 const buffer = Buffer.from(data);
16 const results = decoder.decodeMultiple(buffer);
17 for (let result of results) {
18 console.log(result)
19 }
20});
21