I want to send a delayed message to a socket client. For example, when a new client connects, the message “check started” should be sent to the client, and after certain seconds another message should be selected from the stream.
@socket.on('doSomething', namespace='/test')
def onDoSomething(data):
t = threading.Timer(4, checkSomeResources)
t.start()
emit('doingSomething', 'checking is started')
def checkSomeResources()
emit('doingSomething', 'checking is done')
But the code does not work due to a context problem. I get
RuntimeError('working outside of request context')
Is it possible to emit a stream from a stream?
source
share