Skip to content

Use EventSource for SSE implementation #96

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

Merged
merged 6 commits into from
May 6, 2025
Merged

Use EventSource for SSE implementation #96

merged 6 commits into from
May 6, 2025

Conversation

mattt
Copy link
Contributor

@mattt mattt commented May 6, 2025

This PR updates HTTPClientTransport to use the EventSource package for processing server-sent events, replacing the ad hoc implementation with a more exhaustively tested dependency.

This PR also incorporates changes by @stallent in #91, specifically:

  • Handling 405 response for streaming GET requests: If a server doesn't support streaming from the GET endpoint, it should return a 405. In response, the client cancels the streaming task.
  • Add support for streams coming back from POST requests: This involves changing session.data(for: request) to session.bytes(for: request) in the send function and adding logic to process the SSE stream or JSON data from the response stream.

@mattt mattt force-pushed the mattt/eventsource branch from 582e012 to 1c2f039 Compare May 6, 2025 11:57
@mattt mattt merged commit 3ff1085 into main May 6, 2025
6 checks passed
@mattt mattt deleted the mattt/eventsource branch May 6, 2025 12:45
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

Successfully merging this pull request may close these issues.

1 participant