@laplace.live/event-bridge-server
v0.3.4
Published
LAPLACE Event Bridge Server
Readme
LAPLACE Event Bridge Server (Deprecated)
A specialized WebSocket bridge server that connects LAPLACE Chat to clients.
Features
- Acts as a bridge between LAPLACE Chat and clients
- Server-to-clients message broadcasting
- Role-based connection system
- Token-based authentication
Use Cases
The event bridge enables various use cases:
- Integrate user message events directly with Discord
- Create custom chat layouts in your favorite frontend languages to display chat messages
- Create custom interactions with chat messages in VTube Studio
- Connect to streamer.bot, SAMMI, or other 3rd party services for advanced automation and integrations
Requirements
- Bun v1.0.0 or higher
Installation
From Source
# Clone the repository
git clone https://github.com/laplace-live/event-bridge
cd event-bridge
# Install dependencies
bun installConfiguration
Authentication
You can set authentication in order of precedence:
- Environment variable:
LEB_AUTH="your-secure-token" - Command line:
--auth "your-secure-token"
# Example using environment variable
export LEB_AUTH="your-secure-token"
# Example using CLI
bun run start --auth "your-secure-token"If the authentication token is set, all connections including the clients must provide it to connect.
Network Interface
Control which network interface the server listens on:
- Environment variable:
HOST="127.0.0.1" - Command line:
--host 127.0.0.1
# Listen only on localhost
export HOST="localhost"
# Listen on all interfaces
bun run start --host 0.0.0.0By default, the server listens on localhost.
Debug Mode
Enable detailed debug logging using:
- Environment variable:
DEBUG=1orDEBUG=true - Command line:
--debug
# Enable debug mode using environment variable
export DEBUG=1
# Enable debug mode using CLI
bun run start --debugUsage
Start the Bridge Server
# Start the server
bun run start
# Start with CLI options
bun run start --debug --auth "your-secure-token" --host 0.0.0.0
# Or with hot reloading during development
bun run devThe WebSocket bridge server runs on http://localhost:9696 by default.
Connection Types
The bridge supports two types of connections:
- LAPLACE Chat - Connects with the special protocol
laplace-event-bridge-role-serverand broadcasts messages to all clients - Clients - Regular connections that receive broadcasts from the server
Authentication
When authentication is enabled, clients must provide the auth token in the WebSocket protocol:
- For clients:
['laplace-event-bridge-role-client', 'your-auth-token']
Message Flow
- Messages from the LAPLACE Chat are broadcast to all connected clients
- Messages from clients are acknowledged but not relayed to other clients or the server
Client Demo
A simple HTML client demo is included for testing (client-demo.html):
- Open the file in your web browser
- Configure connection settings (URL, authentication)
- Connect to the bridge
- Receive broadcasts from the LAPLACE Chat
License
AGPL
