Classes
- Client
- Metadata
- Server
- ServerCredentials
- ClientDuplexStream
- ClientReadableStream
- ClientUnaryCall
- ClientWritableStream
- ServerDuplexStream
- ServerReadableStream
- ServerUnaryCall
- ServerWritableStream
Namespaces
Members
(static, constant) callError :number
Call error constants. Call errors almost always indicate bugs in the gRPC library, and these error codes are mainly useful for finding those bugs.
Type:
- number
Properties:
| Name | Type | Description |
|---|---|---|
OK |
number | |
ERROR |
number | |
NOT_ON_SERVER |
number | |
NOT_ON_CLIENT |
number | |
ALREADY_INVOKED |
number | |
NOT_INVOKED |
number | |
ALREADY_FINISHED |
number | |
TOO_MANY_OPERATIONS |
number | |
INVALID_FLAGS |
number | |
INVALID_METADATA |
number | |
INVALID_MESSAGE |
number | |
NOT_SERVER_COMPLETION_QUEUE |
number | |
BATCH_TOO_BIG |
number | |
PAYLOAD_TYPE_MISMATCH |
number |
- Source:
(static, readonly) logVerbosity :number
Type:
- number
Properties:
| Name | Type | Description |
|---|---|---|
DEBUG |
number | |
INFO |
number | |
ERROR |
number |
- Source:
(static) propagate :number
Propagation flags: these can be bitwise or-ed to form the propagation option for calls.
Users are encouraged to write propagation masks as deltas from the default.
i.e. write grpc.propagate.DEFAULTS & ~grpc.propagate.DEADLINE to disable
deadline propagation.
Type:
- number
Properties:
| Name | Type | Description |
|---|---|---|
DEADLINE |
number | |
CENSUS_STATS_CONTEXT |
number | |
CENSUS_TRACING_CONTEXT |
number | |
CANCELLATION |
number | |
DEFAULTS |
number |
- Source:
(static, readonly) status :number
Enum of status codes that gRPC can return
Type:
- number
Properties:
| Name | Type | Description |
|---|---|---|
OK |
number | Not an error; returned on success |
CANCELLED |
number | The operation was cancelled (typically by the caller). |
UNKNOWN |
number | Unknown error. An example of where this error may be returned is if a status value received from another address space belongs to an error-space that is not known in this address space. Also errors raised by APIs that do not return enough error information may be converted to this error. |
INVALID_ARGUMENT |
number | Client specified an invalid argument. Note that this differs from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are problematic regardless of the state of the system (e.g., a malformed file name). |
DEADLINE_EXCEEDED |
number | Deadline expired before operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long enough for the deadline to expire. |
NOT_FOUND |
number | Some requested entity (e.g., file or directory) was not found. |
ALREADY_EXISTS |
number | Some entity that we attempted to create (e.g., file or directory) already exists. |
PERMISSION_DENIED |
number | The caller does not have permission to execute the specified operation. PERMISSION_DENIED must not be used for rejections caused by exhausting some resource (use RESOURCE_EXHAUSTED instead for those errors). PERMISSION_DENIED must not be used if the caller can not be identified (use UNAUTHENTICATED instead for those errors). |
RESOURCE_EXHAUSTED |
number | Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space. |
FAILED_PRECONDITION |
number | Operation was rejected because the system is not in a state required for the operation's execution. For example, directory to be deleted may be non-empty, an rmdir operation is applied to a non-directory, etc. A litmus test that may help a service implementor in deciding between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:
|
ABORTED |
number | The operation was aborted, typically due to a concurrency issue like sequencer check failures, transaction aborts, etc. See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE. |
OUT_OF_RANGE |
number | Operation was attempted past the valid range. E.g., seeking or reading past end of file. Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed if the system state changes. For example, a 32-bit file system will generate INVALID_ARGUMENT if asked to read at an offset that is not in the range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from an offset past the current file size. There is a fair bit of overlap between FAILED_PRECONDITION and OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error) when it applies so that callers who are iterating through a space can easily look for an OUT_OF_RANGE error to detect when they are done. |
UNIMPLEMENTED |
number | Operation is not implemented or not supported/enabled in this service. |
INTERNAL |
number | Internal errors. Means some invariants expected by underlying system has been broken. If you see one of these errors, something is very broken. |
UNAVAILABLE |
number | The service is currently unavailable. This is a most likely a transient condition and may be corrected by retrying with a backoff. See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE. |
DATA_LOSS |
number | Unrecoverable data loss or corruption. |
UNAUTHENTICATED |
number | The request does not have valid authentication credentials for the operation. |
- Source:
(static, readonly) writeFlags :number
Write flags: these can be bitwise or-ed to form write options that modify how data is written.
Type:
- number
Properties:
| Name | Type | Description |
|---|---|---|
BUFFER_HINT |
number | Hint that the write may be buffered and need not go out on the wire immediately. GRPC is free to buffer the message until the next non-buffered write, or until writes_done, but it need not buffer completely or at all. |
NO_COMPRESS |
number | Force compression to be disabled for a particular write |
- Source:
(inner) defaultLoadOptions
Default options for loading proto files into gRPC
- Source:
Methods
(static) closeClient(client_obj)
Parameters:
| Name | Type | Description |
|---|---|---|
client_obj |
grpc.Client | The client to close |
(static) load(filename, formatopt, optionsopt) → {Object.<string, *>}
Load a gRPC object from a .proto file.
Parameters:
| Name | Type | Attributes | Description | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
filename |
string | Object | The file to load |
||||||||||||||||||||||||||
format |
string |
<optional> |
The file format to expect. Must be either 'proto' or 'json'. Defaults to 'proto' |
|||||||||||||||||||||||||
options |
Object |
<optional> |
Options to apply to the loaded file Properties
|
Returns:
The resulting gRPC object
- Type
- Object.<string, *>
(static) loadObject(value, optionsopt) → {Object.<string, *>}
Load a ProtoBuf.js object as a gRPC object.
Parameters:
| Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
value |
Object | The ProtoBuf.js reflection object to load |
|||||||||||||||||||||||||||||||
options |
Object |
<optional> |
Options to apply to the loaded file Properties
|
Returns:
The resulting gRPC object.
- Type
- Object.<string, *>
(static) setLogger(logger)
Sets the logger function for the gRPC module. For debugging purposes, the C core will log synchronously directly to stdout unless this function is called. Note: the output format here is intended to be informational, and is not guaranteed to stay the same in the future. Logs will be directed to logger.error.
Parameters:
| Name | Type | Description |
|---|---|---|
logger |
Console | A Console-like object. |
(static) setLogVerbosity(verbosity)
Sets the logger verbosity for gRPC module logging. The options are members of the grpc.logVerbosity map.
Parameters:
| Name | Type | Description |
|---|---|---|
verbosity |
Number | The minimum severity to log |
(inner) getClientChannel(client) → {Channel}
Return the underlying channel object for the specified client
Parameters:
| Name | Type | Description |
|---|---|---|
client |
Client |
- Source:
- See:
Returns:
The channel
- Type
- Channel
(inner) makeGenericClientConstructor(methods, serviceName, class_options) → {function}
Creates a constructor for a client with the given methods, as specified in
the methods argument. The resulting class will have an instance method for
each method in the service, which is a partial application of one of the
Client request methods, depending on requestSerialize
and responseSerialize, with the method, serialize, and deserialize
arguments predefined.
Parameters:
| Name | Type | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
methods |
grpc~ServiceDefinition | An object mapping method names to method attributes |
||||||||||
serviceName |
string | The fully qualified name of the service |
||||||||||
class_options |
Object | An options object. Properties
|
- Source:
Returns:
New client constructor, which is a subclass of grpc.Client, and has the same arguments as that constructor.
- Type
- function
(inner) waitForClientReady(client, deadline, callback)
Wait for the client to be ready. The callback will be called when the client has successfully connected to the server, and it will be called with an error if the attempt to connect to the server has unrecoverablly failed or if the deadline expires. This function will make the channel start connecting if it has not already done so.
Parameters:
| Name | Type | Description |
|---|---|---|
client |
Client | The client to wait on |
deadline |
grpc~Deadline | When to stop waiting for a connection. Pass Infinity to wait forever. |
callback |
function | The callback to call when done attempting to connect. |
- Source:
- See:
Type Definitions
Deadline
The deadline of an operation. If it is a date, the deadline is reached at the date and time specified. If it is a finite number, it is treated as a number of milliseconds since the Unix Epoch. If it is Infinity, the deadline will never be reached. If it is -Infinity, the deadline has already passed.
Type:
- number | date
- Source:
deserialize(data) → {*}
A deserialization function
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Buffer | The byte sequence to deserialize |
- Source:
Returns:
The data deserialized as a value
- Type
- *
MethodDefinition
An object that completely defines a service method signature.
Type:
- Object
Properties:
| Name | Type | Description |
|---|---|---|
path |
string | The method's URL path |
requestStream |
boolean | Indicates whether the method accepts a stream of requests |
responseStream |
boolean | Indicates whether the method returns a stream of responses |
requestSerialize |
grpc~serialize | Serialization function for request values |
responseSerialize |
grpc~serialize | Serialization function for response values |
requestDeserialize |
grpc~deserialize | Deserialization function for request data |
responseDeserialize |
grpc~deserialize | Deserialization function for repsonse data |
- Source:
serialize(value) → {Buffer}
A serialization function
Parameters:
| Name | Type | Description |
|---|---|---|
value |
* | The value to serialize |
- Source:
Returns:
The value serialized as a byte sequence
- Type
- Buffer
ServiceDefinition
An object that completely defines a service.
Type:
- Object.<string, grpc~MethodDefinition>
- Source:
ServiceError
Describes how a request has failed. The member message will be the same as
details in grpc~StatusObject, and code and metadata are the
same as in that object.
Type:
- Error
Properties:
| Name | Type | Description |
|---|---|---|
code |
number | The error code, a key of grpc.status that is
not |
metadata |
grpc.Metadata | Trailing metadata sent with the status, if applicable |
- Source:
StatusObject
Represents the status of a completed request. If code is
grpc.status.OK, then the request has completed successfully.
Otherwise, the request has failed, details will contain a description of
the error. Either way, metadata contains the trailing response metadata
sent by the server when it finishes processing the call.
Type:
- object
Properties:
| Name | Type | Description |
|---|---|---|
code |
number | The error code, a key of grpc.status |
details |
string | Human-readable description of the status |
metadata |
grpc.Metadata | Trailing metadata sent with the status, if applicable |
- Source: