|
|
|
@ -43,10 +43,7 @@ class BidiStreamingCall extends AbstractCall { |
|
|
|
|
* @param array $metadata Metadata to send with the call, if applicable |
|
|
|
|
*/ |
|
|
|
|
public function start($metadata) { |
|
|
|
|
$event = $this->call->start_batch([ |
|
|
|
|
OP_SEND_INITIAL_METADATA => $metadata, |
|
|
|
|
OP_RECV_INITIAL_METADATA => true]); |
|
|
|
|
$this->metadata = $event->metadata; |
|
|
|
|
$this->call->start_batch([OP_SEND_INITIAL_METADATA => $metadata]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -54,7 +51,14 @@ class BidiStreamingCall extends AbstractCall { |
|
|
|
|
* @return The next value from the server, or null if there is none |
|
|
|
|
*/ |
|
|
|
|
public function read() { |
|
|
|
|
$read_event = $this->call->start_batch([OP_RECV_MESSAGE => true]); |
|
|
|
|
$batch = [OP_RECV_MESSAGE => true]; |
|
|
|
|
if ($this->metadata === null) { |
|
|
|
|
$batch[OP_RECV_INITIAL_METADATA] = true; |
|
|
|
|
} |
|
|
|
|
$read_event = $this->call->start_batch($batch); |
|
|
|
|
if ($this->metadata === null) { |
|
|
|
|
$this->metadata = $read_event->metadata; |
|
|
|
|
} |
|
|
|
|
return $this->deserializeResponse($read_event->message); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|