diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-02-19 19:39:01 +0100 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-02-19 19:39:01 +0100 |
commit | 1787205f04c9008a753618839bc8da72708f5cab (patch) | |
tree | 7501351f6436910bc210124af45d38a2a10bc0eb /api/game/socket.py | |
parent | 5f7ba73f128eddb5c3e4e11dd0025aa1c8d2f385 (diff) |
working socket.io messages v2
Diffstat (limited to 'api/game/socket.py')
-rw-r--r-- | api/game/socket.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/api/game/socket.py b/api/game/socket.py index fdeac73..55bff0f 100644 --- a/api/game/socket.py +++ b/api/game/socket.py @@ -1,12 +1,10 @@ from flask import Blueprint, request, make_response -from flask_socketio import SocketIO, emit, disconnect, emit +from flask_socketio import SocketIO, emit, Namespace from game.voerbak_connector import bord from db import cursor import time import json -namespace = "/game/socket" - class game: def __init__(self, game_id): self.game_id = game_id @@ -21,12 +19,14 @@ class game: def run(app): io = SocketIO(app, cors_allowed_origins="*") - @io.on("new_move", namespace) - def new_move(data): - print(data) + namespace = "/game/socket/" + @io.on("connect", namespace) + def connect(): + print("new connection", namespace) - @io.on("resign", namespace) - def resign(data): + @io.on("new_move") + def connect(data): + print("new_move") print(data) io.run(app, host="127.0.0.1", port=5000, debug=True) |