Receiver of the message is called subscriber in pub/sub pattern. Client connect with broker and requests the topics, broker will publish the topics to subscriber.
Step 1: Open a file at location:contiki/ mqtt-sn-contiki/main_core.c
// To subscribe
mqtt_sn_init(); // initiation
char *topic =”/topic_1″;
Step 2: Initiate the subscriber
void init_sub(void *ptr)
resp_con_t mqtt_sn_sub_send(char *topic, uint8_t qos)
Subscribes the messages from broker.
Step 3: Function receives the topics.
void mqtt_sn_callback(char *topic, char *message)
Recived topic and message from server or broker
Step 4: Run the simulation