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
Streaming Response #143
Streaming Response #143
Conversation
At first seems to do the trick, but did you see https://github.com/http4s/http4s-netty ? It seems to use reactive-streams-netty which translates netty into reactive streams. Http4s uses fs2 and uses the interop module to turn a reactive-stream into a fs2 stream, you could do the same with the interop of ZIO. |
Thanks @Fristi will look https://github.com/http4s/http4s-netty. |
bb68ef8
to
789314e
Compare
zio-http/src/main/scala/zhttp/service/server/ServerRequestHandler.scala
Outdated
Show resolved
Hide resolved
zio-http/src/main/scala/zhttp/service/server/ServerRequestHandler.scala
Outdated
Show resolved
Hide resolved
private def writeAndFlush( | ||
ctx: JChannelHandlerContext, | ||
jReq: JFullHttpRequest, | ||
res: Response.HttpResponse[R, Throwable], | ||
) = { | ||
ctx.writeAndFlush(encodeResponse(jReq.protocolVersion(), res), ctx.channel().voidPromise()) | ||
releaseOrIgnore(jReq) | ||
} | ||
|
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.
private def writeAndFlush( | |
ctx: JChannelHandlerContext, | |
jReq: JFullHttpRequest, | |
res: Response.HttpResponse[R, Throwable], | |
) = { | |
ctx.writeAndFlush(encodeResponse(jReq.protocolVersion(), res), ctx.channel().voidPromise()) | |
releaseOrIgnore(jReq) | |
} |
val app = Http.collect { case Method.GET -> Root / "chunked" => | ||
Response.http( | ||
status = Status.OK, | ||
content = HttpData.StreamData( |
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.
content = HttpData.StreamData( | |
content = HttpData.stream( |
dd2313f
to
04220a7
Compare
No description provided.