{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/1819","labels_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/1819/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/1819/comments","events_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/1819/events","html_url":"https://github.com/ReactiveCocoa/ReactiveCocoa/issues/1819","id":60546277,"number":1819,"title":"replayLazily and updating values","user":{"login":"mAu888","id":637549,"avatar_url":"https://avatars.githubusercontent.com/u/637549?v=3","gravatar_id":"","url":"https://api.github.com/users/mAu888","html_url":"https://github.com/mAu888","followers_url":"https://api.github.com/users/mAu888/followers","following_url":"https://api.github.com/users/mAu888/following{/other_user}","gists_url":"https://api.github.com/users/mAu888/gists{/gist_id}","starred_url":"https://api.github.com/users/mAu888/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mAu888/subscriptions","organizations_url":"https://api.github.com/users/mAu888/orgs","repos_url":"https://api.github.com/users/mAu888/repos","events_url":"https://api.github.com/users/mAu888/events{/privacy}","received_events_url":"https://api.github.com/users/mAu888/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-03-10T18:28:35Z","updated_at":"2015-03-11T17:08:15Z","closed_at":"2015-03-11T17:08:15Z","body":"Hey there, I'm pretty new to the ReactiveCocoa topic and have a question. I'm firing a network request to obtain data once and sending the response to multiple subscribers using the `replayLazily` signal. This works pretty good. But as I want users to be able to reload data and all subscribers should be notified about that data update, how to achieve this best.\r\n\r\nThere are two objects consuming `vehiclesSignal`. I'd now like to have some way that one object can trigger a data reload (i.e. `-reloadVehicles`) and both get notified. Is this somehow achievable with `RACMulticastConnection` and `RACReplaySubject`?\r\n\r\n```objc\r\n- (RACSignal *)vehiclesSignal\r\n{\r\n    static dispatch_once_t onceToken;\r\n    static RACSignal *instance = nil;\r\n\r\n    dispatch_once(&onceToken, ^{\r\n        __weak typeof(self) weakSelf = self;\r\n        instance = [[RACSignal createSignal:^RACDisposable *(id <RACSubscriber> subscriber) {\r\n            __strong typeof(weakSelf) strongSelf = weakSelf;\r\n\r\n            [strongSelf.APIClient vehiclesWithCompletion:^(NSArray *vehicles, NSError *error) {\r\n                if (vehicles)\r\n                {\r\n                    [subscriber sendNext:vehicles];\r\n                    [subscriber sendCompleted];\r\n                }\r\n                else\r\n                {\r\n                    [subscriber sendError:error];\r\n                }\r\n            }];\r\n\r\n            return [RACDisposable disposableWithBlock:^{\r\n                // void.\r\n            }];\r\n        }] replayLazily];\r\n    });\r\n\r\n    return instance;\r\n}\r\n```\r\n\r\nDisclaimer: I already found the post about [obtaining an API access token once](http://stackoverflow.com/questions/14066651/how-to-using-reactivecocoa-to-transparently-authenticate-before-making-api-calls/14072445#14072445), but that did not clarify my question about reloading the underlying data."},"comment":{"url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/comments/78308232","html_url":"https://github.com/ReactiveCocoa/ReactiveCocoa/issues/1819#issuecomment-78308232","issue_url":"https://api.github.com/repos/ReactiveCocoa/ReactiveCocoa/issues/1819","id":78308232,"user":{"login":"mAu888","id":637549,"avatar_url":"https://avatars.githubusercontent.com/u/637549?v=3","gravatar_id":"","url":"https://api.github.com/users/mAu888","html_url":"https://github.com/mAu888","followers_url":"https://api.github.com/users/mAu888/followers","following_url":"https://api.github.com/users/mAu888/following{/other_user}","gists_url":"https://api.github.com/users/mAu888/gists{/gist_id}","starred_url":"https://api.github.com/users/mAu888/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mAu888/subscriptions","organizations_url":"https://api.github.com/users/mAu888/orgs","repos_url":"https://api.github.com/users/mAu888/repos","events_url":"https://api.github.com/users/mAu888/events{/privacy}","received_events_url":"https://api.github.com/users/mAu888/received_events","type":"User","site_admin":false},"created_at":"2015-03-11T17:08:15Z","updated_at":"2015-03-11T17:08:15Z","body":"That works like a charm. For the sake of completeness my final implementation as follows:\r\n\r\n```objc\r\n- (instancetype)initWithAPIClient:(IAAPIClient *)apiClient\r\n{\r\n    self = [super init];\r\n    if ( self )\r\n    {\r\n        _APIClient = apiClient;\r\n        __weak typeof(self) weakSelf = self;\r\n        _vehiclesSignal = [[[self.vehiclesCommand.executionSignals switchToLatest] replayLast] initially:^{\r\n            __strong typeof(weakSelf) strongSelf = weakSelf;\r\n            [strongSelf.vehiclesCommand execute:nil];\r\n        }];\r\n    }\r\n    return self;\r\n}\r\n\r\n- (RACCommand *)vehiclesCommand\r\n{\r\n    if (nil == _vehiclesCommand)\r\n    {\r\n        __weak typeof(self) weakSelf = self;\r\n        _vehiclesCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) {\r\n            return [RACSignal createSignal:^RACDisposable *(id <RACSubscriber> subscriber) {\r\n                __strong typeof(weakSelf) strongSelf = weakSelf;\r\n                [strongSelf.APIClient vehiclesWithCompletion:^(NSArray *vehicles, NSError *error) {\r\n                    if ( vehicles )\r\n                    {\r\n                        [subscriber sendNext:vehicles];\r\n                        [subscriber sendCompleted];\r\n                    }\r\n                    else\r\n                    {\r\n                        [subscriber sendError:error];\r\n                    }\r\n                }];\r\n\r\n                return (RACDisposable *)nil;\r\n            }];\r\n        }];\r\n    }\r\n\r\n    return _vehiclesCommand;\r\n}\r\n```\r\n\r\nOf course I'm open to improvements :-)"}}