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

SSE Client Consumption in Vapor #2959

Open
curiouscoders5 opened this issue Feb 14, 2023 · 1 comment · May be fixed by #2960
Open

SSE Client Consumption in Vapor #2959

curiouscoders5 opened this issue Feb 14, 2023 · 1 comment · May be fixed by #2960
Labels
enhancement New feature or request

Comments

@curiouscoders5
Copy link

Is your feature request related to a problem? Please describe.

Looking for SSE client side support. Namely, being able to consume an external resource which is using Server-Sent Events (link to spec).

Here's an example external resource which can be consumed via SSE:
https://platform.openai.com/docs/api-reference/making-requests
curl https://api.openai.com/v1/completions
-H "Content-Type: application/json"
-H "Authorization: Bearer YOUR_API_KEY"
-d '{"model": "text-davinci-003", "prompt": "Write the code for how to do SSE in swift", "temperature": 0, "max_tokens": 400, "stream": true}'

For testing purposes, it would be ideal if this implementation also included Server side support for SSE, namely so you could output events via SSE.

Here's links to libraries that may be useful for implementing:

https://github.com/swift-server/async-http-client#streaming
https://github.com/inaka/EventSource/blob/master/EventSource/EventSource.swift
https://github.com/inaka/EventSource/blob/master/EventSource/EventStreamParser.swift

Describe the solution you'd like
A Vapor package that can be used to consume SSE events (aka client-side) from an external API.

@curiouscoders5 curiouscoders5 added the enhancement New feature or request label Feb 14, 2023
@curiouscoders5
Copy link
Author

@Joannis tagging you here for visibility.

Thanks absolute boatloads for taking a look at this.

@0xTim 0xTim linked a pull request Feb 16, 2023 that will close this issue
3 tasks
@Joannis Joannis self-assigned this Feb 22, 2023
@Joannis Joannis removed their assignment Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants