diff options
Diffstat (limited to 'src/php/lib/Grpc/ServerStreamingCall.php')
-rw-r--r-- | src/php/lib/Grpc/ServerStreamingCall.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/php/lib/Grpc/ServerStreamingCall.php b/src/php/lib/Grpc/ServerStreamingCall.php index 631c863345..159561b43a 100644 --- a/src/php/lib/Grpc/ServerStreamingCall.php +++ b/src/php/lib/Grpc/ServerStreamingCall.php @@ -40,14 +40,19 @@ namespace Grpc; class ServerStreamingCall extends AbstractCall { /** * Start the call - * @param $arg The argument to send + * @param $data The data to send * @param array $metadata Metadata to send with the call, if applicable + * @param array $options an array of options */ - public function start($arg, $metadata = array()) { + public function start($data, $metadata = array(), $options = array()) { + $message_array = ['message' => $data->serialize()]; + if ($grpc_write_flags = self::getGrpcWriteFlags($options)) { + $message_array['flags'] = $grpc_write_flags; + } $event = $this->call->startBatch([ OP_SEND_INITIAL_METADATA => $metadata, OP_RECV_INITIAL_METADATA => true, - OP_SEND_MESSAGE => $arg->serialize(), + OP_SEND_MESSAGE => $message_array, OP_SEND_CLOSE_FROM_CLIENT => true]); $this->metadata = $event->metadata; } @@ -71,7 +76,7 @@ class ServerStreamingCall extends AbstractCall { public function getStatus() { $status_event = $this->call->startBatch([ OP_RECV_STATUS_ON_CLIENT => true - ]); + ]); return $status_event->status; } -}
\ No newline at end of file +} |