class BidiStream

BidiStream is the response object from a gRPC bidirectional streaming API call.

Methods

__construct(BidiStreamingCall $bidiStreamingCall, array $grpcStreamingDescriptor = [])

BidiStream constructor.

static callable
createApiCall(callable $callable, mixed[] $grpcStreamingDescriptor)

No description

write(mixed $request)

Write request to the server.

writeAll(mixed[] $requests = [])

Write all requests in $requests.

closeWrite()

Inform the server that no more requests will be written. The write() function cannot be called after closeWrite() is called.

mixed
read()

Read the next response from the server. Returns null if the streaming call completed successfully. Throws an ApiException if the streaming call failed.

Generator|mixed[]
closeWriteAndReadAll()

Call closeWrite(), and read all responses from the server, until the streaming call is completed. Throws an ApiException if the streaming call failed.

BidiStreamingCall
getBidiStreamingCall()

Return the underlying gRPC call object

Details

at line 55
__construct(BidiStreamingCall $bidiStreamingCall, array $grpcStreamingDescriptor = [])

BidiStream constructor.

Parameters

BidiStreamingCall $bidiStreamingCall The gRPC bidirectional streaming call object
array $grpcStreamingDescriptor

at line 68
static callable createApiCall(callable $callable, mixed[] $grpcStreamingDescriptor)

Parameters

callable $callable
mixed[] $grpcStreamingDescriptor

Return Value

callable ApiCall

at line 82
write(mixed $request)

Write request to the server.

Parameters

mixed $request The request to write

Exceptions

ValidationException

at line 101
writeAll(mixed[] $requests = [])

Write all requests in $requests.

Parameters

mixed[] $requests An Iterable of request objects to write to the server

Exceptions

ValidationException
ApiException

at line 112
closeWrite()

Inform the server that no more requests will be written. The write() function cannot be called after closeWrite() is called.

at line 133
mixed read()

Read the next response from the server. Returns null if the streaming call completed successfully. Throws an ApiException if the streaming call failed.

Return Value

mixed

Exceptions

ValidationException
ApiException

at line 168
Generator|mixed[] closeWriteAndReadAll()

Call closeWrite(), and read all responses from the server, until the streaming call is completed. Throws an ApiException if the streaming call failed.

Return Value

Generator|mixed[]

Exceptions

ValidationException
ApiException

at line 183
BidiStreamingCall getBidiStreamingCall()

Return the underlying gRPC call object

Return Value

BidiStreamingCall