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
gRPC for Android
Search
Daichi Furiya (Wasabeef)
August 08, 2015
Programming
6
7k
gRPC for Android
introduction to gRPC for Android
Daichi Furiya (Wasabeef)
August 08, 2015
Tweet
Share
More Decks by Daichi Furiya (Wasabeef)
See All by Daichi Furiya (Wasabeef)
About Flutter Architecture
wasabeef
0
150
2023 Flutter/Dart Summary
wasabeef
0
43
I/O Extended 2023 - Dart と Flutter の新機能
wasabeef
0
140
I/O Extended 2023 - Flutter 活用事例
wasabeef
11
2.7k
What it Takes to be a Flutter Developer
wasabeef
0
160
FlutterKaigi 2022 Keynote
wasabeef
1
550
Flutter Hooks を使ったアプリ開発 / App Development with the Flutter Hooks
wasabeef
2
1.3k
Flutter 2021 の振り返りと今後のアプリ開発に向けて / Looking back on Flutter 2021 and for future app development.
wasabeef
4
2.1k
Flutter Hooks, sometimes Jetpack Compose
wasabeef
3
1.7k
Other Decks in Programming
See All in Programming
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
100
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
160
Kaigi on Rails 2024 - Rails APIモードのためのシンプルで効果的なCSRF対策 / kaigionrails-2024-csrf
corocn
5
3.7k
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2k
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.2k
Jakarta EE meets AI
ivargrimstad
0
120
生成 AI を活用した toitta 切片分類機能の裏側 / Inside toitta's AI-Based Factoid Clustering
pokutuna
0
720
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
500
Identifying User Idenity
moro
6
9.4k
僕がつくった48個のWebサービス達
yusukebe
20
17k
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
380
PLoP 2024: The evolution of the microservice architecture pattern language
cer
PRO
0
2.3k
Featured
See All Featured
A Tale of Four Properties
chriscoyier
156
23k
How to Ace a Technical Interview
jacobian
276
23k
RailsConf 2023
tenderlove
29
890
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Raft: Consensus for Rubyists
vanstee
136
6.6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
810
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Teambox: Starting and Learning
jrom
133
8.8k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
Fashionably flexible responsive web design (full day workshop)
malarkey
404
65k
Transcript
H31$GPS"OESPJE !XBTBCFFG@KQ
"CPVU.F @wasabeef_jp CyberAgent, Inc.
8IBUJTH31$
)551
)551 • Binary • Multiplexed • Server Push • Header
compression
-BOHVBHFT
-BOHVBHFT • C/C++ • C# • Java • Go •
Objective-c • Node.js • PHP • Python • Ruby
8IBUJT 1SPUPDPM#VFST
1SPUPDPM#VFST • IDL • Binary • Support code generation (protoc)
VTFSKTPO { id: 1, name: “wasabeef”, createdAt: “20150808” }
VTFSQSPUP syntax = "proto3"; package user; message Profile { string
id = 1; string name = 2; int64 createdAt = 3; }
QSPUPCVG
*OTUBMM # git clone
[email protected]
:google/protobuf.git # cd protobuf # git
checkout v3.0.0-alpha-3.1 # ./autogen.sh # ./configure # make # make check # sudo make install
*OTUBMM # protoc --version libprotoc 3.0.0
3FUSPU
$POWFSUFS
$POWFSUFST • GSON • Jackson • Moshi • Protobuf •
Simplexml • Wire
1SPUP$POWFSUFS Retrofit retrofit = new Retrofit.Builder() .baseUrl("https://api.example.com") .converter(new ProtoConverter()) .build();
0UIFST • Wire (Square) • FlatBuffers (Google) • Message Pack
(Sadayuki Furuhashi)
6TFH31$
FDIPQSPUP syntax = "proto3"; option java_package = “jp.wasabeef.proto.echo”; option go_package
= "echo"; package echo; message EchoRequest { string message = 1; } message EchoReply { string message = 1; } service Echo { rpc Echo (EchoRequest) returns (EchoReply) {} }
$PEFHFOFSBUJPO • protobuf-gradle-plugin • (protoc) • (protoc-gen-grpc-java)
HSQDKBWB
%FQFOEFODJFT compile 'io.grpc:grpc-all:x.y.z'
TBNQMF AsyncSubject<String> subject = AsyncSubject.create(); new Thread(() -> { Channel
channel = OkHttpChannelBuilder.forAddress(“grpc.wasabeef.jp”, 8443) .setConnectionSpec(ConnectionSpec.MODERN_TLS) .sslSocketFactory((SSLSocketFactory)SSLSocketFactory.getDefault()) .build(); EchoGrpc.EchoBlockingStub stub = EchoGrpc.newBlockingStub(channel); Echo.EchoRequest req = new Echo.EchoRequest(); req.setMessage(“YES YES YES!"); Echo.EchoReply reply = stub.echo(req); subject.onNext(reply.getMessage()); subject.onCompleted(); }).start(); subject.observeOn(AndroidSchedulers.mainThread()).subscribe(msg -> { Log.d(“ECHO LOG” ,msg); });
HSQDDPNNPO
%PDVNFOUT https://github.com/grpc/grpc-common
UIBOLT