send method
Implementation
Future<void> send(String type, Uint8List data, {int? id}) async {
final msg = ProtocolMessage(id: id ?? getNextMessageId(), type: type, data: data);
if (_sendError != null) {
throw _sendError!;
}
if (_closed) {
throw StateError('protocol is closed');
}
_send.add(msg);
await msg.sent.future;
}