Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Drop the multiple connections feature.
At this moment, it makes no sense for a single user to create multiple connections to IoT Cloud, since the messages for all the things comes through the same single connection. Creating connections for multiple users at the moment is not supported anyway, because there is no way to authenticate with different tokens, and the profile API is called for the currently authenticated user.
Creating multiple connections for the same user is still possible, but may create confusing situations where some of them are in a connected status and others aren't.
This PR enforces the creation of a single connection at time, requiring to close the currently opened one before opening a new one.
An
updateToken
function is added to allow simplify the token upgrade process, without requiring the ArduinoIoTJs user to close and reopen the connection when the authentication token is expired.