mlesniew / PicoMQTT

ESP MQTT client and broker library
GNU Lesser General Public License v3.0
255 stars 28 forks source link

Subscription callback never called #22

Closed alfonsocatanzaro closed 1 year ago

alfonsocatanzaro commented 1 year ago

Hi, I started from server_local_pubsub.ino. In the example callback is never called. I've tried to subcribe with "#", and with exact topic, without result. Then I've enabled PICOMQTT_DEBUG_TRACE_FUNCTIONS and this is the call trace:

  CALL PicoMQTT::Subscriber::SubscriptionId PicoMQTT::SubscribedMessageListener::subscribe(const String&, std::function<void(char*, void*, unsigned int)>, size_t)
    CALL virtual PicoMQTT::Subscriber::SubscriptionId PicoMQTT::SubscribedMessageListener::subscribe(const String&, PicoMQTT::SubscribedMessageListener::MessageCallback)
      CALL virtual void PicoMQTT::SubscribedMessageListener::unsubscribe(const String&)
      RETURN virtual void PicoMQTT::SubscribedMessageListener::unsubscribe(const String&)
    RETURN virtual PicoMQTT::Subscriber::SubscriptionId PicoMQTT::SubscribedMessageListener::subscribe(const String&, PicoMQTT::SubscribedMessageListener::MessageCallback)
  RETURN PicoMQTT::Subscriber::SubscriptionId PicoMQTT::SubscribedMessageListener::subscribe(const String&, std::function<void(char*, void*, unsigned int)>, size_t)
RETURN PicoMQTT::Subscriber::SubscriptionId PicoMQTT::SubscribedMessageListener::subscribe(const String&, std::function<void(char*, char*)>, size_t)
CALL virtual void PicoMQTT::BasicServer::begin()
RETURN virtual void PicoMQTT::BasicServer::begin()
CALL bool PicoMQTT::Publisher::publish(TopicStringType, const void*, size_t, uint8_t, bool, uint16_t) [with TopicStringType = const char*; size_t = unsigned int; uint8_t = unsigned char; uint16_t = short unsigned int]
  CALL virtual PicoMQTT::Publisher::Publish PicoMQTT::BasicServer::begin_publish(const char*, size_t, uint8_t, bool, uint16_t)
    CALL virtual PicoMQTT::PrintMux PicoMQTT::BasicServer::get_subscribed(const char*)
    RETURN virtual PicoMQTT::PrintMux PicoMQTT::BasicServer::get_subscribed(const char*)
    CALL PicoMQTT::OutgoingPacket::OutgoingPacket(Print&, PicoMQTT::Packet::Type, uint8_t, size_t)
    RETURN PicoMQTT::OutgoingPacket::OutgoingPacket(Print&, PicoMQTT::Packet::Type, uint8_t, size_t)
    CALL PicoMQTT::Publisher::Publish::Publish(PicoMQTT::Publisher&, const PicoMQTT::PrintMux&, uint8_t, size_t, const char*, size_t, uint16_t)
      CALL size_t PicoMQTT::OutgoingPacket::write_header()
        CALL size_t PicoMQTT::OutgoingPacket::write_u8(uint8_t)
          CALL virtual size_t PicoMQTT::OutgoingPacket::write(const uint8_t*, size_t)
            CALL size_t PicoMQTT::OutgoingPacket::write(const void*, size_t, void* (*)(void*, const void*, size_t))
            RETURN size_t PicoMQTT::OutgoingPacket::write(const void*, size_t, void* (*)(void*, const void*, size_t))
          RETURN virtual size_t PicoMQTT::OutgoingPacket::write(const uint8_t*, size_t)
        RETURN size_t PicoMQTT::OutgoingPacket::write_u8(uint8_t)
        CALL size_t PicoMQTT::OutgoingPacket::write_packet_length(size_t)
          CALL size_t PicoMQTT::OutgoingPacket::write_u8(uint8_t)
            CALL virtual size_t PicoMQTT::OutgoingPacket::write(const uint8_t*, size_t)
              CALL size_t PicoMQTT::OutgoingPacket::write(const void*, size_t, void* (*)(void*, const void*, size_t))
              RETURN size_t PicoMQTT::OutgoingPacket::write(const void*, size_t, void* (*)(void*, const void*, size_t))
            RETURN virtual size_t PicoMQTT::OutgoingPacket::write(const uint8_t*, size_t)
          RETURN size_t PicoMQTT::OutgoingPacket::write_u8(uint8_t)
        RETURN size_t PicoMQTT::OutgoingPacket::write_packet_length(size_t)
      RETURN size_t PicoMQTT::OutgoingPacket::write_header()
      CALL size_t PicoMQTT::OutgoingPacket::write_string(const char*, uint16_t)
        CALL size_t PicoMQTT::OutgoingPacket::write_u16(uint16_t)
          CALL size_t PicoMQTT::OutgoingPacket::write_u8(uint8_t)
            CALL virtual size_t PicoMQTT::OutgoingPacket::write(const uint8_t*, size_t)
              CALL size_t PicoMQTT::OutgoingPacket::write(const void*, size_t, void* (*)(void*, const void*, size_t))
              RETURN size_t PicoMQTT::OutgoingPacket::write(const void*, size_t, void* (*)(void*, const void*, size_t))
            RETURN virtual size_t PicoMQTT::OutgoingPacket::write(const uint8_t*, size_t)
          RETURN size_t PicoMQTT::OutgoingPacket::write_u8(uint8_t)
          CALL size_t PicoMQTT::OutgoingPacket::write_u8(uint8_t)
            CALL virtual size_t PicoMQTT::OutgoingPacket::write(const uint8_t*, size_t)
              CALL size_t PicoMQTT::OutgoingPacket::write(const void*, size_t, void* (*)(void*, const void*, size_t))
              RETURN size_t PicoMQTT::OutgoingPacket::write(const void*, size_t, void* (*)(void*, const void*, size_t))
            RETURN virtual size_t PicoMQTT::OutgoingPacket::write(const uint8_t*, size_t)
          RETURN size_t PicoMQTT::OutgoingPacket::write_u8(uint8_t)
        RETURN size_t PicoMQTT::OutgoingPacket::write_u16(uint16_t)
        CALL virtual size_t PicoMQTT::OutgoingPacket::write(const uint8_t*, size_t)
          CALL size_t PicoMQTT::OutgoingPacket::write(const void*, size_t, void* (*)(void*, const void*, size_t))
          RETURN size_t PicoMQTT::OutgoingPacket::write(const void*, size_t, void* (*)(void*, const void*, size_t))
        RETURN virtual size_t PicoMQTT::OutgoingPacket::write(const uint8_t*, size_t)
      RETURN size_t PicoMQTT::OutgoingPacket::write_string(const char*, uint16_t)
    RETURN PicoMQTT::Publisher::Publish::Publish(PicoMQTT::Publisher&, const PicoMQTT::PrintMux&, uint8_t, size_t, const char*, size_t, uint16_t)
    CALL PicoMQTT::Publisher::Publish::Publish(PicoMQTT::Publisher&, const PicoMQTT::PrintMux&, const char*, size_t, size_t, uint8_t, bool, bool, uint16_t)
    RETURN PicoMQTT::Publisher::Publish::Publish(PicoMQTT::Publisher&, const PicoMQTT::PrintMux&, const char*, size_t, size_t, uint8_t, bool, bool, uint16_t)
    CALL PicoMQTT::Publisher::Publish::Publish(PicoMQTT::Publisher&, const PicoMQTT::PrintMux&, const char*, size_t, uint8_t, bool, bool, uint16_t)
    RETURN PicoMQTT::Publisher::Publish::Publish(PicoMQTT::Publisher&, const PicoMQTT::PrintMux&, const char*, size_t, uint8_t, bool, bool, uint16_t)
  RETURN virtual PicoMQTT::Publisher::Publish PicoMQTT::BasicServer::begin_publish(const char*, size_t, uint8_t, bool, uint16_t)
  CALL virtual size_t PicoMQTT::OutgoingPacket::write(const uint8_t*, size_t)
    CALL size_t PicoMQTT::OutgoingPacket::write(const void*, size_t, void* (*)(void*, const void*, size_t))
    RETURN size_t PicoMQTT::OutgoingPacket::write(const void*, size_t, void* (*)(void*, const void*, size_t))
  RETURN virtual size_t PicoMQTT::OutgoingPacket::write(const uint8_t*, size_t)
  CALL virtual bool PicoMQTT::Publisher::Publish::send()
    CALL virtual bool PicoMQTT::OutgoingPacket::send()
      CALL virtual void PicoMQTT::OutgoingPacket::flush()
        CALL virtual size_t PicoMQTT::PrintMux::write(const uint8_t*, size_t)
        RETURN virtual size_t PicoMQTT::PrintMux::write(const uint8_t*, size_t)
      RETURN virtual void PicoMQTT::OutgoingPacket::flush()
    RETURN virtual bool PicoMQTT::OutgoingPacket::send()
  RETURN virtual bool PicoMQTT::Publisher::Publish::send()
  CALL virtual PicoMQTT::Publisher::Publish::~Publish()
  RETURN virtual PicoMQTT::Publisher::Publish::~Publish()
  CALL virtual PicoMQTT::OutgoingPacket::~OutgoingPacket()
  RETURN virtual PicoMQTT::OutgoingPacket::~OutgoingPacket()
RETURN bool PicoMQTT::Publisher::publish(TopicStringType, const void*, size_t, uint8_t, bool, uint16_t) [with TopicStringType = const char*; size_t = unsigned int; uint8_t = unsigned char; uint16_t = short unsigned int]

I noticed that method SubscribedMessageListener::fire_message_callbacks is never called It is an issue? Thank you for help. Alfonso.

alfonsocatanzaro commented 1 year ago

Sorry, I've read just now at https://github.com/mlesniew/PicoMQTT/issues/12

mlesniew commented 1 year ago

No worries!