Create a specific ServerSentEventGenerator version that matches the w…#43
Closed
andredias wants to merge 1 commit intostarfederation:developfrom
Closed
Create a specific ServerSentEventGenerator version that matches the w…#43andredias wants to merge 1 commit intostarfederation:developfrom
andredias wants to merge 1 commit intostarfederation:developfrom
Conversation
…ay FastAPI handles SSE since version 0.135
Collaborator
|
So, turns out you can already do this in the new FastAPI without this PR! @app.get("/updates", response_class=DatastarResponse)
def updates():
yield ServerSentEventGenerator.patch_elements("""<div id="myDiv"></div>""")Should work out of the box. How do you feel about just recommending that way rather than rewriting how it works in the SDK to allow setting The bad news is that the datastar_response decorator is broken with the new fastapi versions. I'd like to find a way to fix that. |
Collaborator
|
I think given that DatastarResponse already works with the new fastapi generator based streaming there isn't a need to implement support for EventstreamResponse. I opened up #44 to remove the datastar_response decorator for fastapi and document the alternative. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request creates a specific ServerSentEventGenerator version that matches the way FastAPI handles SSE since version 0.135
It doesn't break other versions.