Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,11 +14,11 @@ async def echo(websocket):
|
|
| 14 |
timout = 2500
|
| 15 |
async for message in websocket:
|
| 16 |
try:
|
|
|
|
|
|
|
| 17 |
jm = json.loads(message)
|
| 18 |
if jm["token"] == None:
|
| 19 |
await websocket.send(json.dumps({"type": "error", "data": "No token"}))
|
| 20 |
-
p = json.load(open("p.json"))
|
| 21 |
-
b = json.load(open("p.json"))
|
| 22 |
if jm["type"] == "login":
|
| 23 |
if jm["token"] not in p.keys():
|
| 24 |
p.update({jm["token"]: {"pos": {"x": 0,"y": 0, "vy": 0}}})
|
|
@@ -51,7 +51,8 @@ async def echo(websocket):
|
|
| 51 |
except Exception as e:
|
| 52 |
print(e)
|
| 53 |
print(message)
|
| 54 |
-
|
|
|
|
| 55 |
async def main():
|
| 56 |
async with serve(echo, "0.0.0.0", 7860):
|
| 57 |
await asyncio.Future()
|
|
|
|
| 14 |
timout = 2500
|
| 15 |
async for message in websocket:
|
| 16 |
try:
|
| 17 |
+
p = json.load(open("p.json"))
|
| 18 |
+
b = json.load(open("p.json"))
|
| 19 |
jm = json.loads(message)
|
| 20 |
if jm["token"] == None:
|
| 21 |
await websocket.send(json.dumps({"type": "error", "data": "No token"}))
|
|
|
|
|
|
|
| 22 |
if jm["type"] == "login":
|
| 23 |
if jm["token"] not in p.keys():
|
| 24 |
p.update({jm["token"]: {"pos": {"x": 0,"y": 0, "vy": 0}}})
|
|
|
|
| 51 |
except Exception as e:
|
| 52 |
print(e)
|
| 53 |
print(message)
|
| 54 |
+
print(p)
|
| 55 |
+
print(b)
|
| 56 |
async def main():
|
| 57 |
async with serve(echo, "0.0.0.0", 7860):
|
| 58 |
await asyncio.Future()
|