sendChatMessage method

Future<void> sendChatMessage(
  1. String? tradeId,
  2. String? message
)

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:

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);
  }
}