{"action":"created","issue":{"url":"https://api.github.com/repos/pwittchen/ReactiveNetwork/issues/92","repository_url":"https://api.github.com/repos/pwittchen/ReactiveNetwork","labels_url":"https://api.github.com/repos/pwittchen/ReactiveNetwork/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/pwittchen/ReactiveNetwork/issues/92/comments","events_url":"https://api.github.com/repos/pwittchen/ReactiveNetwork/issues/92/events","html_url":"https://github.com/pwittchen/ReactiveNetwork/issues/92","id":182170404,"number":92,"title":"Create Observables with Observable.fromEmitter() instead of Observable.create()","user":{"login":"epicstar","id":7193970,"avatar_url":"https://avatars.githubusercontent.com/u/7193970?v=3","gravatar_id":"","url":"https://api.github.com/users/epicstar","html_url":"https://github.com/epicstar","followers_url":"https://api.github.com/users/epicstar/followers","following_url":"https://api.github.com/users/epicstar/following{/other_user}","gists_url":"https://api.github.com/users/epicstar/gists{/gist_id}","starred_url":"https://api.github.com/users/epicstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epicstar/subscriptions","organizations_url":"https://api.github.com/users/epicstar/orgs","repos_url":"https://api.github.com/users/epicstar/repos","events_url":"https://api.github.com/users/epicstar/events{/privacy}","received_events_url":"https://api.github.com/users/epicstar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-11T04:24:00Z","updated_at":"2016-10-11T21:49:55Z","closed_at":null,"body":"I've noticed that the source code uses `Observable.create()`  methods to either create observables on:\r\n\r\n* Broadcast receivers for broadcasted network events (pre-lollipop)\r\n* network callbacks (lollipop+)\r\n\r\nI've been following talks on RxJava, and one of the biggest sins today is the use of `Observable.create()`. Using this operator to create observables means that you know that you are creating an operator from scratch... from error checking to backpressure.\r\n\r\nInstead, the library should be using the newer operators [Observable.fromEmitter()](http://reactivex.io/RxJava/javadoc/rx/Observable.html#fromEmitter(rx.functions.Action1,%20rx.AsyncEmitter.BackpressureMode)) and possibly [Observable.fromCallable()](http://reactivex.io/RxJava/javadoc/rx/Observable.html#fromCallable(java.util.concurrent.Callable)) which have things baked into them to handle all edge cases so that you only have to worry about implementing the basic parts of the observable.\r\n\r\nThis article explains the use-cases of each operator well: http://www.pacoworks.com/2016/08/21/this-is-not-an-rxjava-tutorial/\r\n\r\nIn addition, the god @JakeWharton goes into great detail on using the newer operators and why 99% of developers will not want to use `Observable.create()` for observable creation: http://fragmentedpodcast.com/episodes/053-jake-wharton-on-rxjava-2/\r\n\r\nIdeally, the library should be using `Observable.fromEmitter()` for both Networking strategies. This operator is a bridge for callback functions to get their operations into the observable world. But maybe perhaps `Observable.fromCallable()` may be worth a read, also."},"comment":{"url":"https://api.github.com/repos/pwittchen/ReactiveNetwork/issues/comments/253057254","html_url":"https://github.com/pwittchen/ReactiveNetwork/issues/92#issuecomment-253057254","issue_url":"https://api.github.com/repos/pwittchen/ReactiveNetwork/issues/92","id":253057254,"user":{"login":"pwittchen","id":695319,"avatar_url":"https://avatars.githubusercontent.com/u/695319?v=3","gravatar_id":"","url":"https://api.github.com/users/pwittchen","html_url":"https://github.com/pwittchen","followers_url":"https://api.github.com/users/pwittchen/followers","following_url":"https://api.github.com/users/pwittchen/following{/other_user}","gists_url":"https://api.github.com/users/pwittchen/gists{/gist_id}","starred_url":"https://api.github.com/users/pwittchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwittchen/subscriptions","organizations_url":"https://api.github.com/users/pwittchen/orgs","repos_url":"https://api.github.com/users/pwittchen/repos","events_url":"https://api.github.com/users/pwittchen/events{/privacy}","received_events_url":"https://api.github.com/users/pwittchen/received_events","type":"User","site_admin":false},"created_at":"2016-10-11T21:49:55Z","updated_at":"2016-10-11T21:49:55Z","body":"Thanks for creating this issue. I'll take a look on that. Any ideas for improvements are welcome."}}
{"actor":{"display_login":"pwittchen"}}