Skip to content

Get ws URI directly from server URL #30

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

Merged
merged 3 commits into from
Mar 27, 2017

Conversation

hermanliang
Copy link
Contributor

ParseLiveQueryClient<ParseObject> parseLiveQueryClient = ParseLiveQueryClient.Factory.getClient();

Get ws URI directly from server URL
ex.

Copy link
Contributor

@mmimeault mmimeault left a comment

Choose a reason for hiding this comment

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

Some questions

this(null);
URL serverUrl = ParseRESTCommand.server;
if (serverUrl == null) {
throw new RuntimeException("serverUrl is null. "
Copy link
Contributor

Choose a reason for hiding this comment

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

checkInit is already called in the other constructor to do that check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

} catch (URISyntaxException e) {
e.printStackTrace();
throw new RuntimeException(e.getMessage());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You could extract that logic into a static util

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed by 1040abb

@@ -23,14 +25,37 @@
private final String applicationId;
private final String clientKey;
private final SparseArray<Subscription<? extends ParseObject>> subscriptions = new SparseArray<>();
private final URI uri;
private URI uri;
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 keep it final, and only pass the result WSS URL when it's parsed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix it
Thanks

@@ -45,6 +51,25 @@
this.webSocketClientCallback = getWebSocketClientCallback();
}

private static URI getDefaultUri() {
URL serverUrl = ParseRESTCommand.server;
if (serverUrl != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

minor change, but i'd return null serverUrl == null and then take this out of an if block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed by d50da48
Thanks 😄

@rogerhu rogerhu merged commit 3368d33 into parse-community:master Mar 27, 2017
@hermanliang hermanliang deleted the ws-uri-from-server-url branch March 30, 2017 03:21
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.

3 participants