LAPLACE Event Bridge
A WebSocket bridge connecting LAPLACE Chat to clients
Monorepo Structure
This repository contains two packages:
- Server (
packages/server
): WebSocket server that routes events between LAPLACE Chat and clients - SDK (
packages/sdk
): TypeScript/JavaScript client for connecting to the bridge - Examples (
examples/
): Examples of how to use the SDK
Features
- Role-based connection system (server/client)
- Server-to-clients message broadcasting
- Token-based authentication
- Reconnection support
Requirements
- Bun v1.2.0 or higher
Installation
Server Package
Configuration
There are multiple ways to configure the server:
Authentication
You can set authentication in order of precedence:
- Environment variable:
LEB_AUTH="your-secure-token"
- Command line:
--auth "your-secure-token"
Network Interface
Control which network interface the server listens on:
- Environment variable:
HOST="127.0.0.1"
- Command line:
--host 127.0.0.1
By default, the server listens on localhost
.
Debug Mode
Enable detailed debug logging using:
- Environment variable:
DEBUG=1
orDEBUG=true
- Command line:
--debug
Usage
The server runs on http://localhost:9696
by default.
SDK Package
The SDK provides a client for connecting to the event bridge.
Installation
Usage
LaplaceEvent
LaplaceEvent
is the core type of the event bridge system, representing events exchanged between LAPLACE Chat and connected clients. Each event contains standardized data for various chat streams from Biliibli Live.
All events share a common type
field that identifies the event category and additional fields specific to each event type.
You can read more about the event types in the Event Types documentation.
Use Cases
- Integrate with Discord, OBS, VTube Studio
- Create custom chat layouts in your preferred frontend
- Connect to 3rd party services like streamer.bot or SAMMI
- ...any other use case you can think of
License
AGPL and MIT