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
900
ハイインテグリティコミットメントを実現するスクラム開発の進化 / Evolution of Scrum for High Integrity Commitment
kaelaela
0
540
アルプのロードマップ変遷 / Alp Roadmap History
kaelaela
0
2.3k
ApexでPofEAA / PofEAA by Apex
kaelaela
2
410
Zap Your DX!
kaelaela
1
470
Clasp使ってGASを快適に開発する / Let's play Clasp
kaelaela
0
500
LWCでローカルコンポーネント開発 / Local development on LWC
kaelaela
1
910
Clean ArchitectureとEffで変更に強いAPIを設計する
kaelaela
8
3.7k
こんなに違う!ScalaとKotlin
kaelaela
2
1.9k
Other Decks in Programming
See All in Programming
CSC307 Lecture 08
javiergs
PRO
0
330
君たちはどうコードをレビューする (される) か / 大吉祥寺.pm
utgwkk
15
8.5k
CSC307 Lecture 13
javiergs
PRO
0
150
継続的な活動で築く地方エンジニアの道
myamashii
2
360
Terraformテスト入門
msato
0
540
Polarsの成長: v0.14からv1.0までの変遷と今後の展望
zerebom
1
350
DDDを志して3年経ったら「DDDの皮を被ったクリーンアーキテクチャ」になった話【デブサミ2024夏】
texmeijin
1
620
なぜ宣言的 UI は壊れにくいのか / Why declarative UI is less fragile
uenitty
29
13k
GraphQL はいいぞ! ~Laravel で学ぶ GraphQL 入門~
azuki
1
160
TiDB Serverless ~理想のServerless DBを考える~
soso_15315
1
160
CSC307 Lecture 09
javiergs
PRO
1
500
Rustのweb開発を助ける 便利なツール紹介
yuki0418
1
190
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
13
430
Music & Morning Musume
bryan
43
5.9k
The Illustrated Children's Guide to Kubernetes
chrisshort
39
47k
Building Applications with DynamoDB
mza
89
5.8k
Optimising Largest Contentful Paint
csswizardry
18
2.6k
The Mythical Team-Month
searls
217
43k
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
325
21k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
121
18k
Documentation Writing (for coders)
carmenintech
63
4.2k
What the flash - Photography Introduction
edds
65
11k
For a Future-Friendly Web
brad_frost
173
9.2k
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 ;-)