Open
Description
I would like to use PubSub. But there is no example out there.
(def (start-pubsub-node host-addresses)
(let* ((c (open-libp2p-client host-addresses: host-addresses options: ["-pubsub" "-pubsubRouter" "gossipsub"] wait: 20))
(self (libp2p-identify c)))
(pubsub-subscribe c "Never")
(for (p (peer-info->string* self))
(displayln "I am " p))
(displayln "Listening for incoming connections")))
(def (start-pubsub-node host-addresses)
(let* ((c (open-libp2p-client host-addresses: host-addresses options: ["-pubsub" "-pubsubRouter" "gossipsub"] wait: 20))
(self (libp2p-identify c)))
(pubsub-subscribe c "Never")
(for (p (peer-info->string* self))
(displayln "I am " p))
(libp2p-connect c peer)
(displayln "Listening for incoming connections")))
I also noticed that there is a channel out there.
(pubsub-subscribe c topic)
c := client
topic: = string
=> (values sub cancel)
sub := channel; message channel
cancel := lambda (); thunk to cancel the subscription
message := (vector ID data seqno topics signature key)
How can I use it?
Metadata
Metadata
Assignees
Labels
No labels