wip: game init by server
This commit is contained in:
parent
bcfc488c2e
commit
342fa0cca3
@ -27,6 +27,11 @@
|
||||
let t = JSON.stringify(msg);
|
||||
window.game_socket.send(t);
|
||||
}
|
||||
|
||||
function setupGame(player_names) {
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="content">
|
||||
|
@ -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');
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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 :(")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user