assertCanSend method

void assertCanSend()

发送前置检查:无网 / WS 未连接时立即失败(不等待 ACK 超时)

Implementation

void assertCanSend() {
  if (!_net.isOnline) {
    throw GoChatException(
      '当前无网络,消息发送失败',
      code: GoChatErrorCode.networkUnavailable,
    );
  }
  if (!_net.ws.isConnected) {
    throw GoChatException(
      'IM 未连接,消息发送失败',
      code: GoChatErrorCode.wsDisconnected,
    );
  }
}