void myqtt_conn_set_on_msg ( MyQttConn conn,
MyQttOnMsgReceived  on_msg,
axlPointer  on_msg_data 
)

Allows to configure the on message handler for the provided connection.

This handler will be called each time a PUBLISH message is received on the provided connection (when acting as a client). See MyQttOnMsgReceived for more information about the handler and the signature you have to provide.

If you want to set a handler to get a notification at the server side (acting as a broker) for every message received see myqtt_ctx_set_on_publish

The handler configured on this function will take precedence over that configured using myqtt_ctx_set_on_msg (which applies to all connections that do not have a handler configured myqtt_conn_set_on_msg).

You can only configure one handler at time. Calling to configure a handler twice will replace previous one.

See also myqtt_ctx_set_on_msg

Parameters
connThe connection that is going to be configured with the handler. Only one handler can be configured. Every call to this function will replace previous one.
on_msgThe handler to be configured.
on_msg_dataUser defined pointer to be passed in to on_msg handler every time it is called.

References myqtt_mutex_lock(), and myqtt_mutex_unlock().