libp2p / go-libp2p-pubsub

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

Topic already exists after topic.Close() #563

Closed master255 closed 1 month ago

master255 commented 1 month 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 1 month 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().