-
Notifications
You must be signed in to change notification settings - Fork 310
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
Add support for server sent events via response asStream #781
Conversation
def decodeSSE: Flow[ByteString, ServerSentEvent, NotUsed] = | ||
//todo decide on max frame length | ||
Framing | ||
.delimiter(ByteString("\n\n"), maximumFrameLength = Int.MaxValue, allowTruncation = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maximumFrameLength
can be parameter accepted by decodeSSE
method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything specified by the SSE standard? Maximum message size? If not, we should make this configurable, with some reasonable default - maybe taken from other impls?
httpclient-backend/zio/src/main/scala/sttp/client3/httpclient/zio/ZioServerSentEvents.scala
Outdated
Show resolved
Hide resolved
testing/server/src/main/scala/sttp/client3/testing/server/HttpServer.scala
Outdated
Show resolved
Hide resolved
) | ||
|
||
object ServerSentEvent { | ||
def parseEvent(event: List[String]): ServerSentEvent = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add some tests?
it's not possible for parsing to fail - there are no invalid inputs?
@adamsmo Are you planning to continue working on this PR, or should I take over? :) |
Please take over, responding to your last comment
It should not be possible for parsing to fail, as it ignores any value with not recognized label. If the line does not contain any I think I do not have push permission to this branch after I was removed from the SML organization |
Released in 3.0.0-RC13 |
Before submitting pull request:
sbt compile
sbt compileDocs
sbt test
sbt scalafmt
docs are still WIP, but the implementation is finished