You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling connect it connects and subscribes correctly to the underlying signal.
Then, disposing the returned RACDisposable unsubscribe correctly from the underlying signal.
Then, reconnecting no longer subscribe to the underlying signal when it should to.
Here is a code you can paste in a sample project to verify.
- (void)testRx
{
NSLog(@"Current Time: %@", NSDate.date);
RACSignal *source = [RACSignal interval:1onScheduler:[RACScheduler scheduler]]; //creates a sequence
RACMulticastConnection *hot = [source publish]; // convert the sequence into a hot sequence
RACDisposable *subscription1 = [hot.signalsubscribeNext:^(id _Nullable x) {
NSLog(@"1: Next(%@)", x);
} error:^(NSError * _Nullable error) {
NSLog(@"1: Error(%@)", error);
} completed:^{
NSLog(@"1: Completed");
}];
NSLog(@"Current Time after 1st subscription: %@", NSDate.date);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
__block RACDisposable *connectionDisposable = [hot connect]; // hot is connected to source and starts pushing value to subscribersNSLog(@"Current Time after Connect: %@", NSDate.date);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSLog(@"Current Time just before 2nd subscription: %@", NSDate.date);
RACDisposable *subscription2 = [hot.signalsubscribeNext:^(id _Nullable x) {
NSLog(@"2: Next(%@)", x);
} error:^(NSError * _Nullable error) {
NSLog(@"2: Error(%@)", error);
} completed:^{
NSLog(@"2: Completed");
}];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSLog(@"Disconnecting");
[connectionDisposable dispose];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSLog(@"Reconnecting");
connectionDisposable = [hot connect]; // this should resubscribe and broadcast values !dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSLog(@"Ending");
[subscription1 dispose];
[subscription2 dispose];
[connectionDisposable dispose];
});
});
});
});
});
}
You can test the equivalent in C# using the code sample from here.
I will work on a PR to fix this.
The text was updated successfully, but these errors were encountered:
When calling
connect
it connects and subscribes correctly to the underlying signal.Then, disposing the returned
RACDisposable
unsubscribe correctly from the underlying signal.Then, reconnecting no longer subscribe to the underlying signal when it should to.
Here is a code you can paste in a sample project to verify.
You can test the equivalent in C# using the code sample from here.
I will work on a PR to fix this.
The text was updated successfully, but these errors were encountered: