Documentation
Welcome to the official Danmaku Server documentation. This guide will help you set up and integrate the high-performance bullet chat backend into your applications.
Note: Danmaku Server is framework-agnostic and can be integrated with any frontend video player system via standard WebSockets.
Quick Start
The fastest way to deploy the server is using Docker. Ensure you have Docker installed on your host machine.
docker pull hysoft/danmaku-server:latest
docker run -d -p 8080:8080 --name danmaku-srv hysoft/danmaku-server
The server will now be listening on ws://localhost:8080.
Environment Variables
Configure the server behavior by passing environment variables:
PORT: The port the HTTP/WebSocket server binds to. Default is8080.MAX_CONNECTIONS: Limit concurrent connections. Default is50000.LICENSE_KEY: Your active subscription key to unlock limits.
WebSocket API Connection
Clients can connect to the server using standard WebSocket protocols. To connect and authenticate (if required):
// Connect to the room ID 'gaming_live_1'
const ws = new WebSocket('wss://yourdomain.com/ws?roomId=gaming_live_1');
ws.onopen = () => {
console.log('Connected to Danmaku Server');
};
ws.onmessage = (event) => {
const danmaku = JSON.parse(event.data);
// Render logic here
};
ZWPlayer Integration
If you are using ZWPlayer, you can directly pass the WebSocket URL to the player's plugin configuration block. ZWPlayer has native protocol awareness for this server.
const player = new ZWPlayer({
container: '#video',
plugins: {
danmaku: {
serverUrl: 'wss://yourdomain.com/ws?roomId=demo'
}
}
});