cloudstate
cloudstate copied to clipboard
HTTP trascoding support grpc stream out x SSE (Server-Side-Events)
I believe that it is possible (and very desirable) that we can define a transcoding grpc to http that supports the sending of data by stream via SSE (server side events). With the support for Stateless functions coming there it would be interesting that we could support the continuous sending of data in an http response via SSE when the user defines a get resource for a grpc service that returns a Stream. I see that it makes no sense to support this for EventSourced but it would be interesting to support this in the case of Stateless functions since we expose all types of supported grpc services (unary, streamed, stream in, stream out). Since AKKA HTTP supports SSE it shouldn't be difficult to map these resources. I believe it would be a revolutionary feature.
Example Given a gRPC service defined as below:
service TagService {
rpc GetTags(GetTag) returns (stream Tag) {
option (google.api.http) = {
get: "/tags/{issuer_id}"
}
};
}
}
And a client-side request like this:
$ curl -N --http2 -H "Accept:text/event-stream" https://some.address.com/tags/001
So the proxy should keep the connection alive and use the SSE protocol to send the response information
@sleipnir Sounds like a great request. One could look at the response type and the accept-header to negotiate the feature on/off.
@viktorklang Yes. The ideal would be to be negotiable
@sleipnir Very WIP and untested, but have a look at https://github.com/cloudstateio/cloudstate/pull/317/files! :)
Very nice @viktorklang , I am following your branch :) I will try to test this as it is. Thank you