@copy_current_request_context
def background_thread():
    """Example of how to send server generated events to clients."""
count = 0
while True:
    time.sleep(10)
count += 1
emit('my response', {'data': 'websocket is keeping alive'}, namespace=
    '/endpoint')
RuntimeError: working outside of request context