Learning about this while working on my datacurve take-home
Rooms QuickStart: https://flask-socketio.readthedocs.io/en/latest/getting_started.html
Handling Messages
When using SocketIO messages are received from both parties as events, (think back to Discord Development days)
Handling Messages
Example:
@socketio.on('message')
def handle_message(data):
print('received message: ' + data)
Different events:
- message
- json
- custom_event (this is something you make/define)
- connect
- disconnect
Sending Messages
You can use emit
or send
to send messages in a namespace