This commit is contained in:
Zutatensuppe 2020-11-19 12:38:50 +01:00
parent d399f2b65f
commit 07da40dce7
4 changed files with 30 additions and 14 deletions

View file

@ -15,13 +15,13 @@ function send(message) {
let clientSeq
let events
function connect(gameId, clientId) {
function connect(gameId, clientId, name) {
clientSeq = 0
events = {}
conn = new WsClient(WS_ADDRESS, clientId + '|' + gameId)
return new Promise(r => {
conn.connect()
send([Protocol.EV_CLIENT_INIT])
send([Protocol.EV_CLIENT_INIT, name])
conn.onSocket('message', async ({ data }) => {
const msg = JSON.parse(data)
const msgType = msg[0]