Skip to content

Instantly share code, notes, and snippets.

@ekoo
Created May 1, 2020 11:25
Show Gist options
  • Save ekoo/44ddc9ab013a4e306d0af39808e9972e to your computer and use it in GitHub Desktop.
Save ekoo/44ddc9ab013a4e306d0af39808e9972e to your computer and use it in GitHub Desktop.
private val client = OkHttpClient.Builder()
.addInterceptor(HttpLoggingInterceptor()
.setLevel(HttpLoggingInterceptor.Level.BASIC))
.build()
private fun scarletLifecycle() = AndroidLifecycle.ofApplicationForeground(getApplication())
private val service = Scarlet.Builder()
.webSocketFactory(client.newWebSocketFactory(BASE_URL))
.addStreamAdapterFactory(RxJava2StreamAdapterFactory())
.addMessageAdapterFactory(GsonMessageAdapter.Factory())
.lifecycle(scarletLifecycle())
.build()
.create(BitcoinService::class.java)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment