1.3 KiB
1.3 KiB
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 for example, configure your bunfig.toml
file:
[install.scopes]
# Use the Campgrounds NPM repository
campgrounds = "https://git.astral.camp/api/packages/campgrounds/npm/"
With NPM, put this in your project's .npmrc:
@campgrounds:registry=https://git.astral.camp/api/packages/campgrounds/npm/
Then, install the package:
bun add @campgrounds/relay-client
# or
npm i @campgrounds/relay-client
Events
Real-time events are exposed from the client as topics which you can subscribe any number of listeners to:
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