Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add installationId to LiveQuery #977

Merged
merged 4 commits into from
Nov 4, 2019
Merged

Add installationId to LiveQuery #977

merged 4 commits into from
Nov 4, 2019

Conversation

dplewis
Copy link
Member

@dplewis dplewis commented Nov 4, 2019

Adds reconnect for error event from server (already reconnects with web socket error).
Adds backwards compatibility for additionalProperties that do not exist in the server.

This PR will require a server update.

Use Case: Determine which client the live query request was sent from.

Will open a PR separately for the following.

subscription.on('create', (object, options) => {
  options.installationId, options.clientId, etc
});

@codecov
Copy link

codecov bot commented Nov 4, 2019

Codecov Report

Merging #977 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #977      +/-   ##
==========================================
+ Coverage   91.84%   91.85%   +0.01%     
==========================================
  Files          54       54              
  Lines        5075     5083       +8     
  Branches     1142     1145       +3     
==========================================
+ Hits         4661     4669       +8     
  Misses        414      414
Impacted Files Coverage Δ
src/LiveQueryClient.js 87.56% <100%> (+0.56%) ⬆️
src/ParseLiveQuery.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bcd8646...76e786b. Read the comment docs.

Copy link
Contributor

@acinader acinader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, I had one comment that I think you should do...

@@ -88,6 +88,7 @@ const DefaultLiveQueryController = {
}
const currentUser = await CoreManager.getUserController().currentUserAsync();
const sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
const installationId = await CoreManager.getInstallationController().currentInstallationId();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should do this async and the current user async together:

const [currentUser, installationId] = await Promise.all([...]);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I keep forgetting about that trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants