wip: game init by server

This commit is contained in:
Stefan Rupp 2020-12-11 17:52:19 +01:00
parent bcfc488c2e
commit 342fa0cca3
3 changed files with 11 additions and 4 deletions

View File

@ -27,6 +27,11 @@
let t = JSON.stringify(msg);
window.game_socket.send(t);
}
function setupGame(player_names) {
}
</script>
<div class="content">

View File

@ -47,6 +47,7 @@
else if (fct == "startGame") {
let names = msg.names
setupGame(names)
alert('game is set up')
}
else {
alert('unknown command: '+event.data);
@ -55,11 +56,10 @@
socket.onclose = function(event) {
if (event.wasClean) {
//alert(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
alert(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
//alert('closed clean');
} else {
// e.g. server process killed or network down
// event.code is usually 1006 in this case
//alert('[close] Connection died');
//alert('closed unclean');
}
};

View File

@ -96,7 +96,9 @@ async def websocket(ws):
color = x['color']
await set_trump_color(player, color)
elif fct == "requestInit":
print("before init")
await initGame(ws);
print("after init")
else:
print("confused :(")