If I was making a networking library how would I b...
# coroutines
e
If I was making a networking library how would I best interface with kotlinx coroutines? Right now I'm not putting in any special effort (in fact the library doesn't even depend on kotlinx coroutines). One of the problems is that you have isActive and isOpen and this kind of strange relationship between errors and connection status. You end up having to have a whole bunch of try catch, close cancel. Would it be "more correct" to remove isOpen/close and instead cancel the job if the socket reaches end of stream? (if this is more correct how do you even fully replace close in practice, seems tricky) Largely unrelated but what's going on with the warning when calling a blocking method in a suspending scope? It seems very hard to satisfy that error if you have your own dispatcher or even know the dispatcher is IO. Do most people simply disable the warning?
for the former: I'm not sure I understand what your API looks like. but perhaps you could take a look at Room and Retrofit, both of which have optional kotlinx.coroutines compatibility