SocketTransport constructor
SocketTransport(
- String _host,
- int _port,
- AbstractSerializer _serializer,
- int _serializerType, {
- dynamic ssl = false,
- dynamic allowInsecureCertificates = false,
- Object? tlsSecurityContext,
- dynamic messageLengthExponent = SocketHelper.maxMessageLengthExponent,
This creates a socket transport instance. The messageLengthExponent configures
the max message length that will be excepted to be send and received. It is negotiated
with the router and may lead into a lower value that messageLengthExponent if
the router only supports shorter messages. The message length is calculated by
2^messageLengthExponent
Implementation
SocketTransport(
this._host,
this._port,
this._serializer,
this._serializerType, {
ssl = false,
allowInsecureCertificates = false,
Object? tlsSecurityContext,
messageLengthExponent = SocketHelper.maxMessageLengthExponent,
}) : assert(
_serializerType == SocketHelper.serializationJson ||
_serializerType == SocketHelper.serializationMsgpack ||
_serializerType == SocketHelper.serializationCbor ||
_serializerType == SocketHelper.serializationFlatBuffers,
),
_tlsSecurityContext = tlsSecurityContext {
_ssl = ssl;
_allowInsecureCertificates = allowInsecureCertificates;
_messageLengthExponent = messageLengthExponent;
if ((_serializerType == SocketHelper.serializationFlatBuffers) !=
(_serializer is flatbuffers.Serializer)) {
throw ArgumentError('FlatBuffers transport requires its matching codec');
}
installNativeCanonicalBase64Codecs(_serializer);
}