Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
WebSocket for Android ver.2
Search
Yuichi Maekawa
September 16, 2016
Programming
1
540
WebSocket for Android ver.2
Yuichi Maekawa
September 16, 2016
Tweet
Share
More Decks by Yuichi Maekawa
See All by Yuichi Maekawa
やらないことを決める
kaelaela
1
850
ハイインテグリティコミットメントを実現するスクラム開発の進化 / Evolution of Scrum for High Integrity Commitment
kaelaela
0
430
アルプのロードマップ変遷 / Alp Roadmap History
kaelaela
0
2.2k
ApexでPofEAA / PofEAA by Apex
kaelaela
2
410
Zap Your DX!
kaelaela
1
440
Clasp使ってGASを快適に開発する / Let's play Clasp
kaelaela
0
470
LWCでローカルコンポーネント開発 / Local development on LWC
kaelaela
1
850
Clean ArchitectureとEffで変更に強いAPIを設計する
kaelaela
8
3.7k
こんなに違う!ScalaとKotlin
kaelaela
2
1.8k
Other Decks in Programming
See All in Programming
Micro Frontends for Java Microservices - Utah JUG 2024
mraible
PRO
1
110
Sheets API使ってみた
toshi0383
2
160
Site Reliability Engineering for GMO
pyama86
8
1.1k
DMMプラットフォームがTiDB Cloudを採用した背景
pospome
9
4.2k
#phpcon_odawara オープン・クローズドなテストフィクスチャを求めて / open closed test fixtures
77web
3
240
GitLab CI/CD で C#/WPFアプリケーションのテストとインストーラーのビルド・デプロイを自動化する
hacarus
0
230
Next.js App Router
quramy
11
1.7k
Netty Chicago Java User Group 2024-04-17
sullis
0
200
Let's learn code review
riofujimon
2
570
検証も兼ねて個人開発でHonoとかと向き合った話
hanetsuki
1
1.3k
Elm 0.19.0 Changes
bkuhlmann
0
510
VS Code をプロダクトにどう取り込むか
onomax
1
650
Featured
See All Featured
The Invisible Customer
myddelton
114
12k
Code Review Best Practice
trishagee
56
15k
No one is an island. Learnings from fostering a developers community.
thoeni
16
2.1k
What's new in Ruby 2.0
geeforr
337
31k
Git: the NoSQL Database
bkeepers
PRO
423
63k
Reflections from 52 weeks, 52 projects
jeffersonlam
345
19k
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
[RailsConf 2023] Rails as a piece of cake
palkan
28
4k
A Tale of Four Properties
chriscoyier
152
22k
YesSQL, Process and Tooling at Scale
rocio
165
13k
Imperfection Machines: The Place of Print at Facebook
scottboms
261
12k
Stop Working from a Prison Cell
hatefulcrawdad
267
19k
Transcript
WebSocket For Android ver.2 @kaelaela(Yuichi Maekawa) 鳥: kaelaela31 蛸猫: kaelaela
ver.1 https://speakerdeck.com/kaelaela/websocket-for-android on Aug 23, 2016 @ Wantedly
The next day
> BROADCAST DESTROY < #REF! -> Broadcast Destroy: http://konifar-zatsu.hatenadiary.jp/entry/2016/07/27/020130
But
This entry’s target is enterprise services.
Sounds logical. I agree to you only if enterprise services.
For normal mobile app • Almost all services have no
proxy • Need real time update!(messaging app or game) • Need low energy consumption! > If you make long polling system, the user say “Battery fire!” and put 1 star...
Use WebSocket in peace ;-)
Do you know okhttp-ws?
Sample code • My sample Android project https://github.com/kaelaela/WebSockcetSample
okhttp-ws
Update of okhttp-ws • Add to main repos on v3.5.0!!(SNAPSHOT
now) PR: #2852 https://github.com/square/okhttp/pull/2852 compile 'com.squareup.okhttp3:okhttp-ws:3.4.1' compile 'com.squareup.okhttp3:okhttp:3.5.0'
Update of okhttp-ws • Remove ws package • Add method
to OkHttpClient okhttp3.ws.* -> okhttp3.* newWebSocketCall
Sample code diff • 3.4.1 -> 3.5.0 https://github.com/kaelaela/WebSockcetSample/commit/45b88ad2ecc5a89dbd493 fc3cc25152511e28529
Echo test: websocket.org
Echo test: websocket.org Supports TLS.
Retrofit? -> No change. It will be added in v2.2!!!
(No due date. 31% complete at 2016-09-16.) • Issue #924 • Commit interface Service { @GET("/chat/{id}") Call<WebSocket> chat(@Path("id") String id); }
Let’s replace your http client with okhttp! If your project
use okhttp.
Thx ;-)