larrythecoder / grpc
gRPC library for PHP
Installs: 1 039
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.1
- sof3/await-generator: ^3.6
Requires (Dev)
- google/auth: ^v1.3.0
Suggests
- ext-protobuf: For better performance, install the protobuf C extension.
- google/protobuf: To get started using grpc quickly, install the native protobuf library.
README
Unofficial work of PHP gRPC implementation for asynchronous calls. The implementation is taken from @arnaud-lb php-async branch.
Here lies the documentation to interact with my own grpc binding library.
Asynchronous calls
PHP does not have an event-loop, therefore user-space event loop is required to check if a call is completed. The following must be called periodically:
Call::drainCompletionQueue(PHP_INT_MIN);
The first parameter specifies the time to wait for any queue to complete. In this case, the completion queue will check if any calls is complete once.
Client gRPC calls
To establish a bidirectional call, user must wait for the connection to be established to the remote server before sending any messages.
This can be achieved by providing a callback to ClientCallInterface::onClientReady(Closure)
.
Alternatively, ClientCallInterface::isReady()
can be used to check if the call is ready to send any message to the remote server.
ClientStreamingCall | BidiStreamingCall |
---|