void myqttd_ctx_add_on_publish ( MyQttdCtx ctx,
MyQttdOnPublish  on_publish,
axlPointer  user_data 
)

Allows to configure (add) a new onPublish handler that will be called every time a publish operation is received.

Handlers configured here (see MyQttdOnPublish) will be able to report any of the codes supported by MyQttPublishCodes, allowing to discard, accept or close the connection (for example). See MyQttPublishCodes for more reference.

Parameters
ctxThe context where the onpublish handler is configured.
on_publishThe on publish handler to be configured.
user_dataA user defined pointer that will be passed in to the handler.

References myqtt_mutex_lock(), and myqtt_mutex_unlock().