sendChatMessage method
Sends a chat message for a specific trade.
Sends a SendChatMessageRequest to send a message in the trade's chat. If the client is not connected, a DaemonNotConnectedException is thrown.
Example:
await tradesService.sendChatMessage('tradeId', 'Hello!');
Throws:
- DaemonNotConnectedException if the client is not connected to the gRPC server.
Implementation
Future<void> sendChatMessage(String? tradeId, String? message) async {
if (!havenoChannel.isConnected) {
throw DaemonNotConnectedException();
}
try {
await havenoChannel.tradesClient!.sendChatMessage(
SendChatMessageRequest(tradeId: tradeId, message: message));
} on GrpcError catch (e) {
handleGrpcError(e);
}
}