messageAvailable method Null safety

  1. @protected
void messageAvailable(
  1. MessageAvailable event
)

Handles the Message Available event of the connection control for handling non connection messages.

Implementation

@protected
void messageAvailable(MessageAvailable event) {
  final messageType = event.message!.header!.messageType;
  MqttLogger.log(
      'MqttConnectionHandlerBase::messageAvailable - message type is $messageType');
  final callback = messageProcessorRegistry[messageType!];
  if (callback != null) {
    callback(event.message);
  } else {
    MqttLogger.log(
        'MqttConnectionHandlerBase::messageAvailable - WARN - no registered callback for this message type');
  }
}