Skip to content

How to generate continous event stream #23

Open
@HR-KSSK

Description

@HR-KSSK

I am trying to generate a continous event stream with this library.

I get this to work by using an endpoint which has to be called by the client which looks like:

@app.route('/api/get/statusupdate')
def status_update():
    controller = TestController()
    while True:
        sse.publish(controller.get_status(), type='greeting')
        time.sleep(5)

I am configuring the plugin with this:

app.config["REDIS_URL"] = "redis://localhost"
app.register_blueprint(sse, url_prefix='/stream')

Now I can call /stream in the client to listen to events, but I need to call /api/get/statusupdate first which is a workaround. Is it possible to do this withiout calling /api/get/statusupdate and directly output some data on the event endpoint?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions