pubsub

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

pubsub a publish subscribe client for IPFS PubSub

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMessageEvent

func NewMessageEvent(topic string, content []byte) events.Event

Creates a new Message event

Types

type EventPayload added in v1.7.0

type EventPayload struct {
	Payload []byte
}

EventPayload An event received on new messages

func NewEventPayload added in v1.7.0

func NewEventPayload(payload []byte) *EventPayload

NewEventPayload Creates a new Message event

type Interface

type Interface interface {
	// Subscribe Subscribes to a topic
	Subscribe(ctx context.Context, topic string) (Subscription, error)

	// Unsubscribe Unsubscribe from a topic
	Unsubscribe(topic string) error

	// Close Unsubscribe from all topics
	Close() error

	// Publish Posts a new message on a topic
	Publish(ctx context.Context, topic string, message []byte) error
}

func NewPubSub

func NewPubSub(coreAPI coreapi.CoreAPI, id peer.ID, opts *Options) (Interface, error)

NewPubSub Creates a new pubsub client

type MessageEvent

type MessageEvent struct {
	Topic   string
	Content []byte
}

MessageEvent Indicates a new message posted on a pubsub topic

type Options added in v1.4.0

type Options struct {
	Logger *zap.Logger
	Tracer trace.Tracer
}

type Subscription

type Subscription interface {
	events.EmitterInterface
	io.Closer
}

Subscription is a pub sub subscription to a topic

func NewSubscription

func NewSubscription(ctx context.Context, ipfs coreapi.CoreAPI, topic string, opts *Options) (Subscription, error)

NewSubscription Creates a new pub sub subscription

Directories

Path Synopsis
directchannel
directchannel
oneonone is a pubsub channel for communication between two peers
oneonone is a pubsub channel for communication between two peers
peermonitor is a package for watching peers on a pub sub channel
peermonitor is a package for watching peers on a pub sub channel

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL