From 7986d9560602528ea3034553eb1f0d82267dabbc Mon Sep 17 00:00:00 2001 From: lonkaars Date: Tue, 16 Feb 2021 16:00:35 +0100 Subject: class namespace in /api/game/socket --- api/game/socket.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'api/game/socket.py') diff --git a/api/game/socket.py b/api/game/socket.py index 405d9cd..7931ada 100644 --- a/api/game/socket.py +++ b/api/game/socket.py @@ -1,10 +1,12 @@ from flask import Blueprint, request, make_response -from flask_socketio import SocketIO, emit, disconnect +from flask_socketio import SocketIO, emit, disconnect, Namespace from main import socketio import time import json -@socketio.on("connect", namespace="/game/socket") -def connect(): - print("connected") +class GameSocketNamespace(Namespace): + def connect(self): + print("connection") + +socketio.on_namespace(GameSocketNamespace("/game/socket")) -- cgit v1.2.3