ReactiveX/RxGo

[docs] README on connectable observable is outdated

su225 opened this issue · 0 comments

su225 commented

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()