Skip to main content


Rivalis provides Client API for connecting any kind of JavaScript client application to your rivalis server.


NodeJS Setup

npm install --save @rivalis/nodejs

Browser Setup

npm install --save @rivalis/browser

AppClient (Console API)

App client provides an API for creating a room or joining already created room. As a response provides endpoint for websocket client and authorization token.

let consoleUrl = 'http://localhost:2334' // depending on where the console app is running
let appId = '1a2b58141505' // appId can be found inside console application
let appClient = new AppClient(consoleUrl, appId)

let roomAccess = appClient.createRoom('my PC', 'myFirstRoom')
// my PC is the name of the fleet where the room shall be created
// myFirstRoom is the desired room type

// or join already created room
let roomAccess = appClient.joinRoom('my PC', '*roomId*')

WebSocket Client

Connect to the server

let ticket = 'connection_ticket' // or token provided by AppClient
let baseURL = 'ws://localhost:26001' // or endpointURL provided by AppClient
let wsClient = new WebSocketClient(baseURL)
wsClient.on('socket:connect', () => {
console.log('connection is established!')

Send message to the Room

let topic = 'chat.message'
let data = {
message: 'hello'
wsClient.send(topic, data)

Listen to a specific topic

wsClient.on('chat.message', (topic, sender, data) => {
// implement your client business logic here!