Flask-socketio, emit an event to another namespace Flask-socketio, emit an event to another namespace flask flask

Flask-socketio, emit an event to another namespace


I had same problems and solved like this.

@socketio.on('connect', namespace='/photo')def client_connect():    socketio.emit('event', { 'type': 'client_connect' }, namespace='/local')


You need to have at least one handler on the second namespace. For example:

@socketio.on('connect', namespace='/local')def local_client_connect():    pass

Then Flask-SocketIO will know about /local and will be able to emit messages to it.