mirror of
https://github.com/aljazceru/squatm3gator.git
synced 2025-12-17 06:34:23 +01:00
21 lines
524 B
Python
21 lines
524 B
Python
from server import socketio
|
|
from flask_socketio import send, emit
|
|
|
|
|
|
@socketio.on('client_connected')
|
|
def handle_client_connect_event(json):
|
|
print('received json: {0}'.format(str(json)))
|
|
|
|
|
|
|
|
@socketio.on('message')
|
|
def handle_json_button(json):
|
|
# it will forward the json to all clients.
|
|
send(json, json=True)
|
|
|
|
|
|
@socketio.on('results')
|
|
def handle_alert_event(json):
|
|
# it will forward the json to all clients.
|
|
print('Message from client was {0}'.format(json))
|
|
emit('results', 'Message from backend') |