I have set up a Flask server with JavaScript browser clients connecting to it via websockets.
I am curious for if I can save a certain socket somewhere in python so that I can emit messages to it specifically.
I haven't tried doing anything, but I can't find any info on what I would like to do.
There's no code to provide...
I expected to be able to do something like:
all_sockets = []
@socketio.on('connection')
def on_connect(socket, json, methods=['GET', 'POST']):
all_sockets.append(socket)
def whisper(socket, message)
socket.emit({"data": message})
whisper(all_sockets[1], "Test")
Much like in node.js's version of websockets it is...