connect library
Implementation of the Connect protocol for Dart. Simple, reliable, interoperable. Protobuf RPC that works
Classes
- AbortSignal
- Notifies when an operation is aborted.
- CallOptions
- Options that can be passed to Transport.unary and Transport.stream.
- CancelableSignal
- An AbortSignal that is triggered by calling the cancel method.
- Codec
- Codec encodes/decodes objects (typically generated from a schema) to and from bytes.
- Compression
- Compression is specialized Codec for a certain compression algorithm.
- DeadlineSignal
- An AbortSignal that aborts at a specific time.
- ErrorDetail
- An ErrorDetail is a self-describing message attached to an ConnectException. Error details are sent over the network to clients, which can then work with strongly-typed data rather than trying to parse a complex error message. For example, you might use details to send a localized error message or retry parameters to the client.
- Headers
- Headers and Trailers for HTTP requests and responses.
- HttpRequest
- A minimal abstraction of an HTTP request.
- HttpResponse
- A minimal abstraction of an HTTP response.
-
Request<
I, O> - Request is used in interceptors to represent a base request. See UnaryRequest, and StreamRequest.
-
Response<
I, O> - Response is used in interceptors to represent a base response. See UnaryResponse, and StreamResponse.
-
Spec<
I, O> - Spec is a description of a client call.
-
StreamRequest<
I, O> - StreamRequest is used in interceptors to represent a request that has zero or more input messages, and zero or more output messages.
-
StreamResponse<
I, O> - StreamResponse is used in interceptors to represent an ongoing call that has zero or more input messages, and zero or more output messages.
- TimeoutSignal
- An AbortSignal that aborts after a certain duration has elapsed.
- Transport
- Transport represents the underlying transport for a client. A transport implements a protocol, such as Connect or gRPC-web, and allows for the concrete clients to be independent of the protocol.
-
UnaryRequest<
I, O> - UnaryRequest is used in interceptors to represent a request with a single input message.
-
UnaryResponse<
I, O> - UnaryResponse is used in interceptors to represent a response with a single output message.
Enums
- Code
- Connect represents categories of errors as codes, and each code maps to a specific HTTP status code. The codes and their semantics were chosen to match gRPC. Only the codes below are valid — there are no user-defined codes.
- Idempotency
- Is this method side-effect-free (or safe in HTTP parlance), or just idempotent, or neither? HTTP based RPC implementation may choose GET verb for safe methods, and PUT verb for idempotent methods instead of the default POST.
- StreamType
- StreamType describes whether the client, server, neither, or both is streaming.
Extension Types
- Client
- Extension used by generated code. Not intended for importing directly.
Extensions
- HeadersExtension on Headers
- Covenient extensions for headers.
Typedefs
-
AnyFn<
I, O> = Future< Response< Function(Request<I, O> >I, O> request) - AnyFn represents the client-side invocation of an RPC. Interceptors can wrap this invocation, add request headers, and wrap parts of the request or response to inspect and log.
-
HttpClient
= Future<
HttpResponse> Function(HttpRequest req) - A minimal abstraction of an HTTP client.
-
Interceptor
= AnyFn<
I, O> Function<I extends Object, O extends Object>(AnyFn< I, O> next) - An interceptor can add logic to clients or servers, similar to the decorators or middleware you may have seen in other libraries. Interceptors may mutate the request and response, catch errors and retry/recover, emit logs, or do nearly everything else.
Exceptions / Errors
- ConnectException
- ConnectException captures four pieces of information: a Code, an error message, an optional cause of the error, and an optional collection of arbitrary Protobuf messages called "details".