void myqtt_listener_set_on_connection_accepted ( MyQttCtx ctx,
MyQttOnAcceptedConnection  on_accepted,
axlPointer  _data 
)

Allows to configure a handler that is executed once a connection have been accepted.

The handler to be configured could be used as a way to get notifications about connections created, but also as a filter for connections that must be dropped.

Parameters
ctxThe context where the operation will be performed.
on_acceptedThe handler to be executed.
_dataUser space data to be passed in to the handler executed.

Note this handler is called before any socket exchange to allow denying as soon as possible. Though the handler receives a reference to the MyQttConn to be accepted/denied, it is only provided to allow storing or reconfiguring the connection.

This function differs from myqtt_ctx_set_on_connect in the sense that the handler configured in this function is called when a connection has been just received and the handler configured at myqtt_ctx_set_on_connect is called when CONNECT MQTT package has been received and fully parsed.

In other words, when the handler is called, the MQTT session is still not established.

This function supports setting up several handlers which will be called in the order they were configured. The function is thread safe.

References myqtt_mutex_lock(), and myqtt_mutex_unlock().