aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/lib/Grpc/BidiStreamingSurfaceActiveCall.php
blob: b5d557e02de8eee0e1d06bb9f52c7df53cf93991 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace Grpc;
require_once realpath(dirname(__FILE__) . '/../autoload.php');

/**
 * Represents an active call that allows for sending and recieving messages in
 * streams in any order.
 */
class BidiStreamingSurfaceActiveCall extends AbstractSurfaceActiveCall {

  /**
   * Reads the next value from the server.
   * @return The next value from the server, or null if there is none
   */
  public function read() {
    return $this->_read();
  }

  /**
   * Writes a single message to the server. This cannot be called after
   * writesDone is called.
   * @param $value The message to send
   */
  public function write($value) {
    $this->_write($value);
  }

  /**
   * Indicate that no more writes will be sent
   */
  public function writesDone() {
    $this->_writesDone();
  }

  /**
   * Wait for the server to send the status, and return it.
   * @return object The status object, with integer $code and string $details
   *     members
   */
  public function getStatus() {
    return $this->_getStatus();
  }
}