Home - rahul-lohra/Snorkl GitHub Wiki
Getting Started
Snorkl is distributed through Github. To use it you need to add the following
- Maven url dependency to the
settings.gradle.kts
File:settings.gradle.kts
dependencyResolutionManagement {
repositories {
maven {
url = uri("https://maven.pkg.github.com/rahul-lohra/Snorkl")
}
}
}
- In
app/build.gradle.kts
file of your android app module (NOT the root file).
File: app/build.gradle.kts
implementation("rahul.lohra.snorkl:snorkl:0.0.2-kotlin1.9")
To monitor HTTP REST Requests
To start using Snorkl, just plug in a new rahul.lohra.snorkl.network.NetworkLoggerInterceptor
to your OkHttp Client Builder:
val client = OkHttpClient.Builder()
.addInterceptor(rahul.lohra.snorkl.network.NetworkLoggerInterceptor())
.build()
To monitor WEBSOCKET Network Requests
Just plug in a new rahul.lohra.snorkl.network.NetworkWebSocketListener
to your OkHttp Client Builder:
val request = Request.Builder().url(WEBSOCKET_URL).build()
val listener = rahul.lohra.snorkl.network.NetworkWebSocketListener()
webSocket = client.newWebSocket(request, listener)