Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I make pub-sub pattern with sse-starlette? Any suggestion? #14

Closed
vaibhavmule opened this issue Dec 10, 2020 · 0 comments
Closed

Comments

@vaibhavmule
Copy link
Contributor

vaibhavmule commented Dec 10, 2020

just like this has a queue in this link encode/starlette#20 (comment)

Example something like this.

from flask import Flask
from flask_sse import sse

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

@app.route('/send')
def send_message():
    sse.publish({"message": "Hello!"}, type='greeting')
    return "Message sent!"

so I can use sse.publish anywhere in the code send things like notification to the client?

PS. I am using FastAPI

@vaibhavmule vaibhavmule changed the title How can I make pub-send pattern with sss-starlette? Any suggestion? How can I make pub-sub pattern with sse-starlette? Any suggestion? Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant