Files
squatm3gator/squatm3-api/websockets.py
2018-12-04 16:01:33 +01:00

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')