browser-go-api/websockets/socket.py

17 lines
359 B
Python
Raw Normal View History

2019-10-07 23:28:11 +00:00
from app import socketio
from flask_socketio import send, emit
@socketio.on('connect')
def handle_connection():
print('''
wow, there was a socketio connection!
cool
''')
send({'data':'connection'})
@socketio.on('message')
def handle_message(message):
print(message)
emit('message return', {'data':'a message was sent'})