protocol

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package protocol defines types for the chat protocol.

Index

Constants

This section is empty.

Variables

View Source
var (
	MessageReceived = &view.View{
		Name:        "stratumn-node/views/chat/message-received",
		Description: "chat message received",
		Measure:     msgReceived.Measure,
		TagKeys:     []tag.Key{monitoring.PeerIDTag.OCTag},
		Aggregation: view.Count(),
	}

	MessageSent = &view.View{
		Name:        "stratumn-node/views/chat/message-sent",
		Description: "chat message sent",
		Measure:     msgSent.Measure,
		TagKeys:     []tag.Key{monitoring.PeerIDTag.OCTag},
		Aggregation: view.Count(),
	}

	MessageError = &view.View{
		Name:        "stratumn-node/views/chat/message-error",
		Description: "chat message error",
		Measure:     msgError.Measure,
		TagKeys:     []tag.Key{monitoring.PeerIDTag.OCTag},
		Aggregation: view.Count(),
	}
)

Views exposed by the chat app.

View Source
var ProtocolID = protocol.ID("/stratumn/node/chat/v1.0.0")

ProtocolID is the protocol ID of the service.

Functions

This section is empty.

Types

type Chat

type Chat struct {
	// contains filtered or unexported fields
}

Chat implements the chat protocol.

func NewChat

func NewChat(host Host, eventEmitter event.Emitter, msgReceivedCh chan *pbchat.DatedMessage) *Chat

NewChat creates a new chat server.

func (*Chat) Send

func (c *Chat) Send(ctx context.Context, pid peer.ID, message string) error

Send sends a message to a peer.

func (*Chat) StreamHandler

func (c *Chat) StreamHandler(ctx context.Context, stream inet.Stream)

StreamHandler handles incoming messages from peers.

type Host

type Host = ihost.Host

Host represents a Stratumn Node host.

Jump to

Keyboard shortcuts

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