From 0f1e86b52954e89e92694fe25a98af8ad2db6a95 Mon Sep 17 00:00:00 2001 From: endeavorance Date: Fri, 4 Jul 2025 20:18:28 +0000 Subject: [PATCH] Update README.md --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3bc3623..11c9147 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,46 @@ -# relay-client +# Stardust Relay Client -Documentation for the Stardust Relay client \ No newline at end of file +A TypeScript client for the Stardust Relay + +## Getting Started + +To install through an NPM-compatible package manager, start by configuring your package manager to know about Campgrounds packages. If using [Bun](https://bun.sh) for example, configure your `bunfig.toml` file: + +```toml +[install.scopes] +# Use the Campgrounds NPM repository +campgrounds = "https://git.astral.camp/api/packages/campgrounds/npm/" +``` + +Then, install the package: + +```shell +bun add @campgrounds/relay-client +``` + +## Events + +Real-time events are exposed from the client as topics which you can subscribe any number of listeners to: + +```typescript +const client = new RelayClient(API_KEY); + +client.Events.Chat.new.subscribe(message => { + console.log("Incoming message:", message); +}) +``` + +The following events are available to subscribe to: + +- `Events.Chat.new` +- `Events.Chat.deleted` +- `Events.Post.new` +- `Events.Stream.live` +- `Events.Stream.request` +- `Events.Stream.follow` +- `Events.Stream.subscription` +- `Events.Stream.giftedSubscription` +- `Events.Stream.massGiftedSubscription` +- `Events.Stream.raid` +- `Events.Stream.cheer` +- `Events.custom`