socket

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ControlCharacter defines the end of socket communication.
	ControlCharacter byte = '\a'
	// ControlCharacterString defines the end of socket communication.
	ControlCharacterString = "\a"
)

Variables

View Source
var SignalReload = Signal("reload")

SignalReload is the event for reloading all the Baito.

Functions

This section is empty.

Types

type Signal

type Signal []byte

A Signal is an event sent through a socket.

type Socket added in v0.1.2

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

A Socket is used to send and receive signals through socket.

func New added in v0.1.2

func New(socket string) *Socket

New returns a new Socket.

func (*Socket) Close added in v0.1.2

func (s *Socket) Close() error

Close closes the listener if Listen as been called.

func (*Socket) Listen added in v0.1.2

func (s *Socket) Listen(handler func(event []byte) []byte) error

Listen opens the socket and wait for incoming events.

func (*Socket) Request added in v0.1.2

func (s *Socket) Request(event []byte) ([]byte, error)

Request dials the socket with the given event.

Jump to

Keyboard shortcuts

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