libp2p / go-libp2p-pubsub

The PubSub implementation for go-libp2p
https://github.com/libp2p/specs/tree/master/pubsub
Other
328 stars 186 forks source link

Topic already exists after topic.Close() #563

Closed master255 closed 4 months ago

master255 commented 4 months ago

How do I unsubscribe from a topic? And what does topic.Close() do? If not deleting it. Or is it a bug?

What I'm doing: ... ps, err := pubsub.NewGossipSub(ctx, h) topic, err := ps.Join(pubTitle) sub, err := topic.Subscribe() ... topic.Close() topic1, err := ps.Join(pubTitle) err == "topic already exists"

How do I unsubscribe from a topic and re-subscribe?

master255 commented 4 months ago

I forgot that I also need to do sub.Cancel() But it is not comfortable. It would be possible to cancel all subscriptions by topic.Close().