lib/src/connector/v1/connector.cc
// WebSocket - onOpen callback (will send the PCP Associate Session request)
onOpen callback (will send the PCP Associate Session request)
onOpen callback ( will send the PCP Associate Session request )
void Connector::associateSession()
{
    Util::lock_guard<Util::mutex> the_lock { session_association_.mtx };
    if (!session_association_.in_progress.load())
        LOG_DEBUG("About to send the Associate Session request; unexpectedly the "
                  "Connector does not seem to be in the associating state. "
                  "Note that the Association timings will be reset.");
    session_association_.got_messaging_failure = false;
    session_association_.error.clear();
    association_timings_.reset();
    auto envelope = createEnvelope(std::vector<std::string> { MY_BROKER_URI },
                                   Protocol::ASSOCIATE_REQ_TYPE,
                                   session_association_.association_timeout_s,
                                   false,
                                   session_association_.request_id);
    Message msg { envelope };
    LOG_INFO("Sending Associate Session request with id {1} and a TTL of {2} s",
             session_association_.request_id, session_association_.association_timeout_s);
    send(msg);
}
void Connector :: associateSession ( ) { Util :: lock_guard < Util :: mutex > the_lock { session_association_ . mtx } ; if ( ! session_association_ . in_progress . load ( ) ) LOG_DEBUG ( " " " " " " ) ; session_association_ . got_messaging_failure = false ; session_association_ . error . clear ( ) ; association_timings_ . reset ( ) ; auto envelope = createEnvelope ( std :: vector < std :: string > { MY_BROKER_URI } , Protocol :: ASSOCIATE_REQ_TYPE , session_association_ . association_timeout_s , false , session_association_ . request_id ) ; Message msg { envelope } ; LOG_INFO ( " " , session_association_ . request_id , session_association_ . association_timeout_s ) ; send ( msg ) ; }
WebSocket - onOpen callback (will send the PCP Associate Session request)
WebSocket - onOpen callback ( will send the PCP Associate Session request )
// Envelope // NB: createEnvelope will update session_association_.request_id // Create and send message // NB: don't report a possible failure to session_association_; //     just let the onOpen handler close the WebSocket connection //     and let a connection_association_error be triggered