protocol

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: Apache-2.0, BSD-2-Clause Imports: 5 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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