Bombed HI command
This commit is contained in:
parent
6b594a6255
commit
62b4080635
2 changed files with 0 additions and 8 deletions
|
@ -14,7 +14,6 @@ You run the server by:
|
||||||
|
|
||||||
You can send raw text to the WS server. This text is in form of commands:
|
You can send raw text to the WS server. This text is in form of commands:
|
||||||
|
|
||||||
- `HI` will reply with a message response;
|
|
||||||
- `GET` will reply with a message response too;
|
- `GET` will reply with a message response too;
|
||||||
- `MSG {token} {message}` will set the message and broadcast it to all logged-in clients;
|
- `MSG {token} {message}` will set the message and broadcast it to all logged-in clients;
|
||||||
- `CLEAR {token}` will clear the current message.
|
- `CLEAR {token}` will clear the current message.
|
||||||
|
|
7
main.py
7
main.py
|
@ -17,13 +17,6 @@ async def handle(websocket):
|
||||||
if websocket not in CONNECTIONS:
|
if websocket not in CONNECTIONS:
|
||||||
CONNECTIONS.add(websocket)
|
CONNECTIONS.add(websocket)
|
||||||
async for message in websocket:
|
async for message in websocket:
|
||||||
# parse message
|
|
||||||
if message == "HI":
|
|
||||||
# new client said hi
|
|
||||||
if message == "":
|
|
||||||
await websocket.send("HI")
|
|
||||||
else:
|
|
||||||
await websocket.send(f"HI {EAS_MESSAGE}")
|
|
||||||
if message == "GET":
|
if message == "GET":
|
||||||
await websocket.send(f"MSG {EAS_MESSAGE}")
|
await websocket.send(f"MSG {EAS_MESSAGE}")
|
||||||
if message.startswith(f"MSG {TOKEN} "):
|
if message.startswith(f"MSG {TOKEN} "):
|
||||||
|
|
Reference in a new issue