Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] README on connectable observable is outdated #333

Open
su225 opened this issue Nov 4, 2021 · 0 comments
Open

[docs] README on connectable observable is outdated #333

su225 opened this issue Nov 4, 2021 · 0 comments
Assignees

Comments

@su225
Copy link

su225 commented Nov 4, 2021

https://github.com/ReactiveX/RxGo#connectable-observable

The documentation shows the following

disposed, cancel := observable.Connect()
go func() {
	// Do something
	time.Sleep(time.Second)
	// Then cancel the subscription
	cancel()
}()
// Wait for the subscription to be disposed
<-disposed

But now, connect takes a context. The API has changed and it should be something like this

ctx, cancelFunc := observable.Connect(context.Background())
go func() {
        // Do something
	time.Sleep(time.Second)
        // Then cancel the subscription
	cancelFunc()
}()
// Wait for the subscription to be disposed
<-ctx.Done()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants