-
-
Notifications
You must be signed in to change notification settings - Fork 32
Add experimental OkHttp3 websocket client support #19
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
Conversation
This may become unnecessary if/when we move to OkHttp3 (parse-community#19). But for now it's the only way to see the exact JSON data that is being sent over the websocket.
This may become unnecessary if/when we move to OkHttp3 (#19). But for now it's the only way to see the exact JSON data that is being sent over the websocket.
|
||
private OkHttp3WebSocketClient(WebSocketClientCallback webSocketClientCallback, URI hostUrl) { | ||
this.webSocketClientCallback = webSocketClientCallback; | ||
client = new OkHttpClient(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we don't reuse the client, maybe we should only create it in the open() method when creating the websocket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've created two constructors now, one default that instantiates one, and another that allows you to pass one in...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm not sure to understand. Maybe my comment wasn't clear.
Why did you add the ability to pass a OkHttpClient? Is it useful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes adding a custom OkHttpClient Is useful for troubleshooting and custom options:
https://code.facebook.com/posts/393927910787513/stetho-a-new-debugging-platform-for-android/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK thanks for the clarification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small comment
087dbd2
to
8c4241d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, let's try it. Small comment then it's all good IMO.
private final WebSocketClientCallback webSocketClientCallback; | ||
private WebSocket webSocket; | ||
private State state = State.NONE; | ||
private OkHttpClient client; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make it final.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good thanks
We should deprecate TubeSocket if this works.
We should deprecate TubeSocket if this works.
@mmimeault