Documentation ¶
Index ¶
- Constants
- Variables
- type Subscription
- type WakuRelay
- func (w *WakuRelay) EnoughPeersToPublish() bool
- func (w *WakuRelay) EnoughPeersToPublishToTopic(topic string) bool
- func (w *WakuRelay) PubSub() *pubsub.PubSub
- func (w *WakuRelay) Publish(ctx context.Context, message *pb.WakuMessage) ([]byte, error)
- func (w *WakuRelay) PublishToTopic(ctx context.Context, message *pb.WakuMessage, topic string) ([]byte, error)
- func (w *WakuRelay) SetPubSub(pubSub *pubsub.PubSub)
- func (w *WakuRelay) Start(ctx context.Context) error
- func (w *WakuRelay) Stop()
- func (w *WakuRelay) Subscribe(ctx context.Context) (*Subscription, error)
- func (w *WakuRelay) SubscribeToTopic(ctx context.Context, topic string) (*Subscription, error)
- func (w *WakuRelay) Topics() []string
- func (w *WakuRelay) Unsubscribe(ctx context.Context, topic string) error
Constants ¶
const WakuRelayID_v200 = protocol.ID("/vac/waku/relay/2.0.0")
Variables ¶
var DefaultWakuTopic string = waku_proto.DefaultPubsubTopic().String()
Functions ¶
This section is empty.
Types ¶
type Subscription ¶
type Subscription struct { sync.RWMutex // C is channel used for receiving envelopes C chan *protocol.Envelope // contains filtered or unexported fields }
Subscription handles the subscrition to a particular pubsub topic
func (*Subscription) IsClosed ¶
func (subs *Subscription) IsClosed() bool
IsClosed determine whether a Subscription is still open for receiving messages
func (*Subscription) Unsubscribe ¶
func (subs *Subscription) Unsubscribe()
Unsubscribe will close a subscription from a pubsub topic. Will close the message channel
type WakuRelay ¶
type WakuRelay struct {
// contains filtered or unexported fields
}
func NewWakuRelay ¶
func NewWakuRelay(h host.Host, bcaster v2.Broadcaster, minPeersToPublish int, timesource timesource.Timesource, log *zap.Logger, opts ...pubsub.Option) *WakuRelay
NewWakuRelay returns a new instance of a WakuRelay struct
func (*WakuRelay) EnoughPeersToPublish ¶
EnoughPeersToPublish returns whether there are enough peers connected in the default waku pubsub topic
func (*WakuRelay) EnoughPeersToPublishToTopic ¶
EnoughPeersToPublish returns whether there are enough peers connected in a pubsub topic
func (*WakuRelay) Publish ¶
Publish is used to broadcast a WakuMessage to the default waku pubsub topic
func (*WakuRelay) PublishToTopic ¶
func (w *WakuRelay) PublishToTopic(ctx context.Context, message *pb.WakuMessage, topic string) ([]byte, error)
PublishToTopic is used to broadcast a WakuMessage to a pubsub topic
func (*WakuRelay) Stop ¶
func (w *WakuRelay) Stop()
Stop unmounts the relay protocol and stops all subscriptions
func (*WakuRelay) Subscribe ¶
func (w *WakuRelay) Subscribe(ctx context.Context) (*Subscription, error)
SubscribeToTopic returns a Subscription to receive messages from the default waku pubsub topic
func (*WakuRelay) SubscribeToTopic ¶
SubscribeToTopic returns a Subscription to receive messages from a pubsub topic