IPWorks IoT 2020 Python Edition

Questions / Feedback?

on_topic_info Event

Fired when the client receives a REGISTER packet from the gateway assigning a topic id to a topic name.

Syntax

class MQTTSNTopicInfoEventParams(object):
  @property
  def topic_id() -> int: ...
  @property
  def topic_name() -> str: ...
  @property
  def return_code() -> int: ...
  @return_code.setter
  def return_code(value) -> None: ...

# In class MQTTSN:
@property
def on_topic_info() -> Callable[[MQTTSNTopicInfoEventParams], None]: ...
@on_topic_info.setter
def on_topic_info(event_hook: Callable[[MQTTSNTopicInfoEventParams], None]) -> None: ...

Remarks

A gateway sends a REGISTER packet to a client if it wants to inform that client about the topic name and the assigned topic id that it will use later on when sending PUBLISH messages of the corresponding topic name. The client must establish a new topic id mapping to the topic name indicated.

This happens for example when the client connects without starting a clean session or the client has subscribed to topic names that contain wildcard characters.

When a REGISTER packet is received, the class will respond with a REGACK packet. To set the value of the return code contained in the packet, set it to one of the below values.

  • 0: accepted
  • 1: rejected - congestion
  • 2: rejected - invalid topic id
  • 3: rejected - not supported

When a client subscribes to a topic with wildcard characters, the specific topic names it will receive messages on have not yet been registered to topic ids, so the first step in receiving such messages is the REGISTER packet. It can then receive incoming messages with that id. See on_message_in for more.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks IoT 2020 Python Edition - Version 20.0 [Build 8265]