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 a web socket call concept for connecting. #1182

Closed
wants to merge 1 commit into from

Conversation

JakeWharton
Copy link
Member

Similar to HTTP and Call, the WebSocketCall is a representation of a pending HTTP request and subsequent upgrade to speak web sockets. Upon synchronous execution you are handed a WebSocket instance for synchronous writing and also pass in a WebSocketListener for async callbacks due to reading.

The API changes in this commits also generalize WebSocket such that it's agnostic to being a client or server peer.

Not implemented yet is an async version of the initial HTTP request (enqueue).

Closes #1173. Refs #193.

@JakeWharton JakeWharton force-pushed the jw/websocket-call branch 2 times, most recently from 9aa7441 to 60dbab2 Compare December 2, 2014 08:20
import okio.ByteString;
import okio.Okio;

public class WebSocketCall {
Copy link
Member

Choose a reason for hiding this comment

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

final ?

Copy link
Member Author

Choose a reason for hiding this comment

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

This matches Call for testing, I guess.

@swankjesse
Copy link
Member

LGTM.

I'm not quite sure how this gets you where you're going, but the code looks good.

Similar to HTTP and Call, the WebSocketCall is a representation of a pending HTTP request and subsequent upgrade to speak web sockets. Upon synchronous execution you are handed a WebSocket instance for synchronous writing and also pass in a WebSocketListener for async callbacks due to reading.

The API changes in this commits also generalize WebSocket such that it's agnostic to being a client or server peer.

Not implemented yet is an async version of the initial HTTP request (enqueue).
return;
}
WebSocketCall call = WebSocketCall.newWebSocketCall(client, request);
WebSocket webSocket = call.execute(this);
Copy link
Member Author

Choose a reason for hiding this comment

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

This might be a step backwards since you can no longer handle things like a 404 in calling code.

@JakeWharton
Copy link
Member Author

Closing for now.

@JakeWharton JakeWharton closed this Dec 4, 2014
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.

WebSocket API should be applicable (and usable) by client and server
2 participants