-
Notifications
You must be signed in to change notification settings - Fork 143
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
Question: Is it possible to use OkHttp as a network stack on Android? #224
Comments
That's an interesting question; we might get some advantages from using a fully fledged HTTP client, but on the other hand we only need a simple WebSocket. There's also the problem (for this official library) that OkHttp only supports API levels 21 and above, which probably means it's not something we'll pursue. Does this solve a specific problem? |
Ok let me expand on my question:
|
That makes a lot of sense, thank you for expanding. I am worried the current implementation is so tightly coupled with the low-level WS library that changing this would require a complete rewrite. But I'll look into it. I don't think we really need pure Java support, this library mainly (only?) exists to support Android. Any change that would improve the experience on Android is welcome IMO. |
Yeah it would be great if WS and OkHttp implementation were modularized as optional components via interfaces. If you need inspiration on the programming design pattern how to do this, take a look at these 2 implementations: ExoPlayer: https://github.com/google/ExoPlayer/tree/release-v2/extensions/okhttp These 2 implement integration only for standard one-off requests, but as I said, OkHttp also has a native API for WebSocket implementation which you could use. I have a project coming up where I'd use Pusher WebSocket, and will try to play with this myself. |
And how complicated would it be to implement it? OkHttp also works on pure Java so it wouldn't be a problem for the library in general.
The text was updated successfully, but these errors were encountered: