MqttInvitationHandler constructor

MqttInvitationHandler(
  1. ClientHandler clientHandler
)

Implementation

MqttInvitationHandler(this.clientHandler) {
  clientHandler.allMessagesStream().listen((payloadWithTopic) {
    String topic = payloadWithTopic.topic;
    if (topic.isPersonalEventTopic) {
      var bm = BaseMessage.fromString(payloadWithTopic.payload);
      //Check first if it is an invitation related topic
      if (bm.isInvitationEvent()) {
        InvitationMessage invitationMessage =
            InvitationMessage.fromString(payloadWithTopic.payload);
        if (bm.isInvitationResponseEvent()) {
          _invitationsUpdatesController.add(invitationMessage);
        } else {
          _invitationsController.add(invitationMessage);
        }
      }
    }
  });
}