send method
Implementation
@override
void send(AbstractMessage message) {
if (message is Goodbye) {
_goodbyeSent = true;
}
if (!_handshakeCompleter.isCompleted) {
if (_outboundBuffer!.isEmpty) {
_handshakeCompleter.future.then((aVoid) {
_send0(_outboundBuffer!);
_outboundBuffer = null;
});
}
var serialalizedMessage = _serializer.serialize(message);
if (serialalizedMessage is String) {
serialalizedMessage = utf8.encoder.convert(serialalizedMessage);
}
_outboundBuffer!.addAll(SocketHelper.buildMessageHeader(
SocketHelper.messageWamp,
serialalizedMessage.length,
isUpgradedProtocol));
_outboundBuffer!.addAll(serialalizedMessage);
} else {
var serialalizedMessage = _serializer.serialize(message);
if (serialalizedMessage is String) {
serialalizedMessage = utf8.encoder.convert(serialalizedMessage);
}
_send0(SocketHelper.buildMessageHeader(SocketHelper.messageWamp,
serialalizedMessage.length, isUpgradedProtocol));
_send0(serialalizedMessage);
}
}