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 Ox integration: SSE & WebSockets? #2158
Comments
Wouldn't that be a |
For all other streaming approaches we simply offer a SSE-parsing stream stage, e.g.: https://sttp.softwaremill.com/en/stable/backends/akka.html#server-sent-events
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The default backend is already fully usable for direct style Scala, along with streaming (via
InputStream
bodies), and web sockets (using theWebSocket
's blocking.send()
and.receive()
methods).However, what we are missing is integration with SSE, streaming websockets (sometimes its more convenient to work this way) and high-level streaming (mapping over byte chunks or lines, for example).
That's why it might reasonable to have an Ox integration module. In fact, this is a joint Ox+sttp-client issue, as it requires changes in both. Going from the end:
Source
, such as two-way conversions between anInputStream
and aSource[byte chunk]
; between anInputStream
and aSource[String]
(lines); and finally writing such sources to files/reading from files. What remains to be determined here is what's a good representation of abyte chunk
. A simpleArray[Byte]
?ByteBuffer
? Pekko'sBytString
?WebSocket
and a(Source[WebSocketFrame], Sink[WebSocketFrame]
Example usage:
The text was updated successfully, but these errors were encountered: