Update README.md

This commit is contained in:
Endeavorance 2025-07-04 20:18:28 +00:00
parent 41eaa66960
commit 0f1e86b529

View file

@ -1,3 +1,46 @@
# relay-client
# Stardust Relay Client
Documentation for the Stardust Relay client
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`