I have created a prototype for my intended app. It works, I can create topics and subscribe to them. I basically followed this post but had to update a couple of things to current libs.
go Discover(ctx, h, dht, RendeVousLabel)
topic, err := gossipSub.Join(topicStr)
if err != nil {
return nil, err
}
subscriber, err := topic.Subscribe()
// etc
But I can’t find the way to unsubscribe!!! Only the PubSubRouter
interface has a Leave
function, which is documented like this:
> // Leave notifies the router that we are no longer interested in a topic.
> // It is invoked after the unsubscription announcement.
But how does it get an unsubscription announcement? Even heavy googling couldn’t yield me any useful result.
I find this pretty odd, maybe the code has changed so much that I am doing it the wrong way? Am I missing something?
The topic
struct has a Close
func, but that sounds like it’s going to close the topic for everyone, and unsubscribing with a Close
feels weird to me, but maybe that’s it?