Handling gRPC requests with client-stream and/or server-stream in mezzio-swoole (PHP), is it possible?

326 Views Asked by At

The framework is Mezzio and the server is Swoole, both the latest version.

Please note that Mezzio is just an example but Swoole is the main case.

When a request is arrived, swoole onRequest event is triggered and EventDispatcher dispatches the event to the relevant event, which in this case is RequestEvent. Then, RequestHandlerRequestListener converts the swoole request to a Psr7Request in order to handle it using a middleware or handler of mezzio. Finally, the response is emitted and the end() method of server is called.

So, what if the request is a gRPC request with stream client and/or stream server mode. In this case when a request is arrived with options, the swoole server should awaits for subsequent messages and based on server unary or stream mode, returns the response.

I want to know, can the swoole-server handle stream requests and stream responses for a gRPC communication?

0

There are 0 best solutions below