oneonone

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

oneonone is a pubsub channel for communication between two peers

Index

Constants

View Source
const PROTOCOL = "ipfs-pubsub-direct-channel/v1"

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel interface {
	events.EmitterInterface

	// ID Returns the Channel ID (pubsub topic)
	ID() string

	// Peers Returns the lists of peers expected to be in the channel
	Peers() []p2pcore.PeerID

	// Connect Waits for the other peer to be connected
	Connect(context.Context) error

	// Sends Sends a message to the other peer
	Send(context.Context, []byte) error

	// Close Closes the connection
	Close() error
}

Channel Channel is a pubsub used for a direct communication between peers new messages are received via events

func NewChannel

func NewChannel(ctx context.Context, ipfs coreapi.CoreAPI, pid p2pcore.PeerID) (Channel, error)

NewChannel Creates a new pubsub topic for communication between two peers

type EventMessage

type EventMessage struct {
	Payload []byte
}

EventMessage An event received on new messages

func NewEventMessage

func NewEventMessage(payload []byte) *EventMessage

NewEventMessage Creates a new Message event

Jump to

Keyboard shortcuts

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