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
560
WebSocket for Android ver.2
Yuichi Maekawa
September 16, 2016
Tweet
Share
More Decks by Yuichi Maekawa
See All by Yuichi Maekawa
やらないことを決める
kaelaela
1
1.1k
ハイインテグリティコミットメントを実現するスクラム開発の進化 / Evolution of Scrum for High Integrity Commitment
kaelaela
1
780
アルプのロードマップ変遷 / Alp Roadmap History
kaelaela
0
2.7k
ApexでPofEAA / PofEAA by Apex
kaelaela
2
470
Zap Your DX!
kaelaela
1
550
Clasp使ってGASを快適に開発する / Let's play Clasp
kaelaela
0
580
LWCでローカルコンポーネント開発 / Local development on LWC
kaelaela
1
1.1k
Clean ArchitectureとEffで変更に強いAPIを設計する
kaelaela
8
4k
こんなに違う!ScalaとKotlin
kaelaela
2
2.1k
Other Decks in Programming
See All in Programming
Create a website using Spatial Web
akkeylab
0
300
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
250
AIプログラマーDevinは PHPerの夢を見るか?
shinyasaita
1
120
PostgreSQLのRow Level SecurityをPHPのORMで扱う Eloquent vs Doctrine #phpcon #track2
77web
2
340
Team operations that are not burdened by SRE
kazatohiei
1
210
「ElixirでIoT!!」のこれまでとこれから
takasehideki
0
370
ReadMoreTextView
fornewid
1
480
プロダクト志向ってなんなんだろうね
righttouch
PRO
0
160
『自分のデータだけ見せたい!』を叶える──Laravel × Casbin で複雑権限をスッキリ解きほぐす 25 分
akitotsukahara
1
550
生成AIで日々のエラー調査を進めたい
yuyaabo
0
650
High-Level Programming Languages in AI Era -Human Thought and Mind-
hayat01sh1da
PRO
0
290
PHPで始める振る舞い駆動開発(Behaviour-Driven Development)
ohmori_yusuke
2
190
Featured
See All Featured
Balancing Empowerment & Direction
lara
1
370
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
490
BBQ
matthewcrist
89
9.7k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
The Language of Interfaces
destraynor
158
25k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
22k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
5
210
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
30
2.1k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
Building a Modern Day E-commerce SEO Strategy
aleyda
42
7.3k
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 ;-)