JakeWharton / retrofit2-kotlin-coroutines-adapter

A Retrofit 2 adapter for Kotlin coroutine's Deferred type.
Apache License 2.0
1.97k stars 129 forks source link

Fire and forget #42

Closed lanmonster closed 5 years ago

lanmonster commented 5 years ago

I have a use case where I'm hitting a server, but I do not need the response at all. Is there a way to use coroutines to support this?

JakeWharton commented 5 years ago

You can specify the return type as Void? which will discard the response stream as soon as it's received and deliver a null. If you're just asking about firing off a coroutine and not caring about its result you can use GlobalScope.launch for that.