You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 19, 2025. It is now read-only.
Nulled edited this page Jun 19, 2021
·
5 revisions
Description
The websockets used for communicating between game client and server are provided by Socket.io.
In order to communicate with the socket a special client is needed called "socket.io-client@2.0.0". To establish the connection we do need to add a few querys too.
Queries
"firebaseToken" - Accesstoken used for authentication
"gameMode" - Gamemode to connect to (eg "en")
"spectate" - Boolean, Used to specify if the player should join as a spectator
"gameId" - GameId to connect to
"playWithFriends" - Boolean, Is the game you want to join a friends lobby?
"reconnect" - Boolean, Used for reconnecting
"password" - Used to connect to password protected lobbys
How to connect
constio=require('socket.io-client')// import socket.io-clientconstparams={query: {firebaseToken: 'token',//... your querys ...},transports: ['websocket']// we dont want to use slow http long polling}constsocket=io.connect('https://api-games.werewolf-apps.com',params)// Open socket on games apisocket.on('game-joined',data=>console.log(JSON.parse(data)))// example listenersocket.emit('game:chat-public:msg',JSON.stringify({msg: 'some text'}))// sample event