Send web API signal from python API.

Asked 2 years ago, Updated 2 years ago, 51 views

Hello. Python studying in Python flask in Ubuntu environment.

I want to send a signal to the web in the middle of the work, but when I looked up the SSE (server sent event) example, it returned at the end. Is there a way to send a signal through the web in the middle? Thank you.

@route("/start", methods=['POST'})
def start():
    data=request.form['data']

    Task 1

    (Signal to web before return Signaling to task 1)

    Task 2
    Task 3

    return jsonify(True)

python web

2022-09-21 23:08

1 Answers

I don't understand exactly what it means to send a signal to the web, but I'll understand it as sending a request to the client.

http is connectionless.

Disconnect the client request as soon as it is processed by the server.

Requests from the server to the client must be made in a different way.

There are some things related to comedy. It is also called reverse Ajax and it is also implemented as long pooling.

If you can use html5, it is convenient to use a web socket.


2022-09-21 23:08

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.