aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/lib/Grpc/UnaryCall.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/php/lib/Grpc/UnaryCall.php')
-rw-r--r--src/php/lib/Grpc/UnaryCall.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/php/lib/Grpc/UnaryCall.php b/src/php/lib/Grpc/UnaryCall.php
index 97a10a40f4..38af6b1d74 100644
--- a/src/php/lib/Grpc/UnaryCall.php
+++ b/src/php/lib/Grpc/UnaryCall.php
@@ -40,14 +40,20 @@ namespace Grpc;
class UnaryCall 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, possible keys:
+ * 'flags' => a number
*/
- public function start($arg, $metadata = array()) {
+ public function start($data, $metadata = array(), $options = array()) {
+ $message_array = ['message' => $data->serialize()];
+ if (isset($options['flags'])) {
+ $message_array['flags'] = $options['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;
}
@@ -62,4 +68,4 @@ class UnaryCall extends AbstractCall {
OP_RECV_STATUS_ON_CLIENT => true]);
return array($this->deserializeResponse($event->message), $event->status);
}
-} \ No newline at end of file
+}