Notice
Recent Posts
Recent Comments
올해는 머신러닝이다.
Retrofit2 에서 Rx사용시 Single 이 더 나을까? 본문
출처 : https://stackoverflow.com/a/42005735
I'd suggest using a Single
as it is more accurate representation of the data flow: you make a request to the server and the you get either one emission of data OR an error:
Single: onSubscribe (onSuccess | onError)?
For an Observable
you could theoretically get several emissions of data AND an error
Observable: onSubscribe onNext? (onCompleted | onError)?
However, if you are using rx-java2, I'd suggest using a Maybe
instead of Single
. The difference between those two is that Maybe
handles also the case when you get the response from server but it contains no body.
Maybe: onSubscribe (onSuccess | onCompleted | onError)?
'링크모음 > rxjava' 카테고리의 다른 글
RxJava를 활용한 페이징(Paging) (0) | 2017.09.13 |
---|---|
RxJava1 -< 2로 올릴때 주의할 점 (0) | 2017.08.28 |
Observable과 Flowable을 언제 써야할까? (0) | 2017.08.25 |
RxJava2.0 변경점 링크(번역본포함) (0) | 2017.08.24 |
MVP + Dagger 2 + RX 패턴 및 예제 (0) | 2017.08.11 |