protocol

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: Apache-2.0, BSD-2-Clause Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Events

type Events struct {
	// Holds event instances to attach to for received messages.
	// Use a message's ID to get the corresponding event.
	Received []*event.Event[[]byte]
	// Fired for generic protocol errors.
	Error *event.Event[error]
}

Events holds protocol related events.

type Protocol

type Protocol struct {
	// Holds events for sent/received messages and generic errors.
	Events *Events
	// contains filtered or unexported fields
}

Protocol encapsulates the logic of parsing and sending protocol messages.

func New

func New(r *message.Registry) *Protocol

New generates a new protocol instance which is ready to read a first message header.

func (*Protocol) Read

func (p *Protocol) Read(data []byte) (int, error)

Read acts as an event handler for received data.

type VoidEvent

type VoidEvent struct{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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