send method
Sends a message to a destination
Implementation
Future<String?> send({
required String destination,
String? body,
Uint8List? bodyBytes,
String? contentType,
String? transactionId,
bool requestReceipt = false,
Map<String, String>? headers,
}) async {
_ensureConnected();
String? receiptId;
if (requestReceipt) {
receiptId = _generateReceiptId();
}
final sendFrame = StompFrameFactory.send(
destination: destination,
body: body,
bodyBytes: bodyBytes,
contentType: contentType,
receipt: receiptId,
transaction: transactionId,
additionalHeaders: headers,
);
await _sendFrame(sendFrame);
// Add to transaction if specified
if (transactionId != null) {
_transactionManager.addFrameToTransaction(transactionId, sendFrame);
}
// Wait for receipt if requested
if (receiptId != null) {
await _waitForReceipt(receiptId, _timeout);
}
return receiptId;
}