chanOpts function
ChannelOptions
chanOpts(})
Builds ChannelOptions suitable for a ClientChannel.
The value of credentials
- MAY use
ChannelCredentials.insecurewhen targeting a local server instance. - MUST use
ChannelCredentials.securewhen targeting a remote server instance.
The 'user-agent' request header will indicate the grpcVersion.
See github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#user-agents.
It SHOULD match the version of the caller's package:grpc dependency, like '3.1.0'.
Callers MAY specify their own package version, user device info, etc. in userAgentFragments.
They will be appended to the user-agent string as specified in the link above.
['foo', 'bar/v1', 'baz'] => 'grpc-dart/$grpcVersion (foo; bar/v1; baz)'
Implementation
ChannelOptions chanOpts(ChannelCredentials credentials, String grpcVersion,
{List<Codec> codecs = const [GzipCodec(), IdentityCodec()],
List<String> userAgentFragments = const []}) =>
ChannelOptions(
credentials: credentials,
codecRegistry: CodecRegistry(codecs: codecs),
userAgent: _ua(grpcVersion, userAgentFragments));