handlePublish method

Future<bool> handlePublish(
  1. String topic,
  2. String message
)

JSON RPC MESSAGE HANDLERS

Implementation

Future<bool> handlePublish(String topic, String message) async {
  core.logger.t('[$runtimeType]: Handling Publish Message: $topic, $message');
  // If we want to ignore the message, stop
  if (await _shouldIgnoreMessageEvent(topic, message)) {
    core.logger.w('[$runtimeType]: Ignoring Message: $topic, $message');
    return false;
  }

  // Record a message event
  await messageTracker.recordMessageEvent(topic, message);

  // Broadcast the message
  onRelayClientMessage.broadcast(
    MessageEvent(
      topic,
      message,
      DateTime.now().millisecondsSinceEpoch,
      TransportType.relay,
    ),
  );
  return true;
}