Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WebSocket for Android

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on.

WebSocket for Android

Avatar for Yuichi Maekawa

Yuichi Maekawa

August 23, 2016
Tweet

More Decks by Yuichi Maekawa

Other Decks in Technology

Transcript

  1. Overview of WebSocket • Bidirectional communication • port: 80 or

    443 • scheme: ws or wss • binary support • RFC6455
  2. Pros • No request header(So, hi-Speed!) • Real time communication

    • available HTTP resource(proxy, filter, auth...)
  3. Using WebSocket with OkHttp • Repos    https://github.com/square/okhttp/tree/master/okhttp-ws Note: This

    module's API should be considered experimental and may be subject to breaking changes in future releases.
  4. Using WebSocket with OkHttp • add dependencies ※ need permission:

    android.permission.INTERNET • create WebSocketListener extends class …show my sample code. compile 'com.squareup.okhttp3:okhttp-ws:3.4.1'
  5. Sample code • Okhttp-ws: repo   Only 7 classes :-)   sample

    class: WebSocketEcho.java WebSocet test: https://www.websocket.org/echo.html • My sample https://github.com/kaelaela/WebSockcetSample
  6. History of okhttp-ws • Version 2.3.0: Beta release • Version

    2.4.0-RC1: Bug fix • Version 2.4.0: WebSocketListener has incompatible changes. • Version 2.6.0: ◦ WebSocket API now uses RequestBody and ResponseBody for messages. ◦ Bug fix • Version 3.1.0: WebSockets now defer some writes. • Version 3.3.1: Bug fix
  7. Milestone of okhttp-ws v3.5(Due by August 31, 2016) • some

    bug fix v3.6(Due by September 30, 2016) • some bug fix • status code enhancement(issue) But, most issues are deferred. Let pray. more information: show websocket label
  8. Retrofit? maybe add v2.2!!!(No due date. 29% complete at 2016-08-21.)

    • Issue #924 • Commit interface Service { @GET("/chat/{id}") Call<WebSocket> chat(@Path("id") String id); }