in src/core/connectionHelpers/connectionDetailsProvider.js [69:90]
_fetchConnectionDetails() {
// If this is a customer session, use the provided participantToken to call createParticipantConnection for our connection details.
if (this.sessionType === SESSION_TYPES.CUSTOMER) {
return this._callCreateParticipantConnection();
}
// If this is an agent session, we can't assume that the participantToken is valid.
// In this case, we use the getConnectionToken API to fetch a valid connectionToken and expiry.
// If that fails, for now we try with createParticipantConnection.
else if (this.sessionType === SESSION_TYPES.AGENT){
return this.getConnectionToken()
.then((response) => this._handleGetConnectionTokenResponse(response.chatTokenTransport))
.catch(() => {
return this._callCreateParticipantConnection();
});
}
else {
return Promise.reject({
reason: "Failed to fetch connectionDetails.",
_debug: new IllegalArgumentException("Failed to fetch connectionDetails.")
});
}
}