This is a plugin for Facebook debugging tool Flipper for logging gRPC requests from mobile clients.
You need to install desktop version of the plugin to the Flipper desktop app. Open View
> Manage Plugins
> Install plugins
and search for grpc
. Once installed restart the desktop app.
dependencies {
...
implementation "cz.ackee.flipper:grpc:x.x.x"
}
Inside your Flipper init phase add FlipperGrpcPlugin
and keep the instance somewhere to be used later
class App : Application() {
companion object {
val flipperGrpcPlugin = FlipperGrpcPlugin()
}
override fun onCreate() {
super.onCreate()
SoLoader.init(this, false)
val client = AndroidFlipperClient.getInstance(this)
...
client.addPlugin(flipperGrpcPlugin)
...
}
}
When creating your gRPC channel add ClientInterceptor
provided by the plugin
val channel = OkHttpChannelBuilder
...
.intercept(App.flipperGrpcPlugin.getInterceptor())
.build()
and that's it. If you run your app you should now see requests in Flipper
If you want to run Android sample app you need either to provide your own proto files and definition of host/port
or you can use the demo helloworld
app taken from grpc-java
(repository)[https://github.com/grpc/grpc-java/tree/master/examples].
You need to build the hello-world-server
app and run it on your localhost and then use emulator to run the sample app.
Currently gRPC Swift does not have a concept of interceptors and without them it's hard to provide a library that could be easily plugged in your code. We are watching closely this issue in the repository and once possible we will hop on that!