Skip to content

Instantly share code, notes, and snippets.

@VitaliyBelyaev
Created September 10, 2018 14:40
Show Gist options
  • Save VitaliyBelyaev/b7e9cdb43fe675a8900af48737ee2b55 to your computer and use it in GitHub Desktop.
Save VitaliyBelyaev/b7e9cdb43fe675a8900af48737ee2b55 to your computer and use it in GitHub Desktop.
Func
fun getIceCandidate(): Flowable<IceCandidate> {
return Flowable.create({ emitter ->
socket.on("videoChat_iceCandidate_p2p", {
val adapter = moshi.adapter<IceCandidate>(IceCandidate::class.java)
try {
val result = adapter.fromJson(it.joinToString())
emitter.onNext(result!!)
} catch (e: JsonDataException) {
e.printStackTrace()
}
})
}, BackpressureStrategy.LATEST)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment