Created
September 10, 2018 14:40
-
-
Save VitaliyBelyaev/b7e9cdb43fe675a8900af48737ee2b55 to your computer and use it in GitHub Desktop.
Func
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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