4 ms·
HTTP/1.x will allow you to stream requests from the client. It'll also let you stream chunked responses from the server. But it won't let you do both simultaneo
by Xorlev 9y ago
HTTP/1.x will allow you to stream requests from the client. It'll also let you stream chunked responses from the server. But it won't let you do both simultaneously without going more exotic.
Speaking from my own experience in Java, especially testing my gRPC/HTTP bridge[1], streaming is never overly easy with HTTP clients. You're usually just handed a byte stream to handle yourself. Streaming to the server from the client has been another really interesting exercise to get right.
That's part of what's nice about gRPC (aside from the RPC model and protobuf serialization). If you want unary semantics, done. If you want streaming, it's just a keyword away, and it works across all languages.
[1] https://github.com/Xorlev/grpc-jersey https://github.com/Xorlev/grpc-jersey
- chrissnell 9y agoCan't speak for Java but it was super easy in Go. I wrote some software for my home weather station and it streams [1] over gRPC to another little Go app [2] that runs on my laptop, wherever it may be. My use is not at all complex but I can't imagine that more involved streaming would be any tougher. [1] https://github.com/chrissnell/gopherwx/blob/master/storage_grpc.go https://github.com/chrissnell/gopherwx/blob/master/storage_g... [2] https://github.com/chrissnell/grpc-weather-bar https://github.com/chrissnell/grpc-weather-bar Edit: here's a simple example protobuf definition for streaming to a client: https://github.com/chrissnell/gopherwx/blob/master/protobuf/grpcweather.proto https://github.com/chrissnell/gopherwx/blob/master/protobuf/...