socket

package
v1.5.1-eth-call Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMaxMessageSize is the number of bytes to cap messages at by default
	DefaultMaxMessageSize = 2 * units.MiB
)

Variables

View Source
var ErrMessageTooLarge = errors.New("message to large")

ErrMessageTooLarge is returned when reading a message that is larger than our max size

Functions

This section is empty.

Types

type Client

type Client struct {
	net.Conn
	// contains filtered or unexported fields
}

Client is a read-only connection to a socket

func Dial

func Dial(addr string) (*Client, error)

Dial creates a new *Client connected to the given address over a Unix socket

func (*Client) Close

func (c *Client) Close() error

Close closes the underlying socket connection

func (*Client) Recv

func (c *Client) Recv() ([]byte, error)

Recv waits for a message from the socket. It's guaranteed to either return a complete message or an error

func (*Client) SetMaxMessageSize

func (c *Client) SetMaxMessageSize(s int64)

SetMaxMessageSize sets the maximum size to allow for messages

type Socket

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

Socket manages sending messages over a socket to many subscribed clients

func NewSocket

func NewSocket(addr string, log logging.Logger) *Socket

NewSocket creates a new socket object for the given address. It does not open the socket until Listen is called.

func (*Socket) Close

func (s *Socket) Close() error

Close closes the socket by cutting off new connections, closing all existing ones, and then zero'ing out the connection pool

func (*Socket) Listen

func (s *Socket) Listen() error

Listen starts listening on the socket for new connection

func (*Socket) Running added in v1.0.6

func (s *Socket) Running() bool

func (*Socket) Send

func (s *Socket) Send(msg []byte)

Send writes the given message to all connection clients

Jump to

Keyboard shortcuts

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