ctl

package
v1.43.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func Dial

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

func (*Client) Close

func (c *Client) Close() error

func (*Client) Send

func (c *Client) Send(e Event) (interface{}, error)

type Event

type Event struct {
	Name  string      `json:"name"`
	Data  interface{} `json:"data"`
	Reply bool        `json:"reply"`
}

Event represents an event either received from or sent to a client.

func (Event) Bytes

func (e Event) Bytes() []byte

type Server

type Server struct {
	Addr string

	OnConnect    func(c net.Conn)
	OnDisconnect func(c net.Conn)
	OnEvent      func(c net.Conn, e Event)

	// ErrorLog specifies an optional log function for errors. If not set,
	// errors are not reported.
	ErrorLog func(error)
	// contains filtered or unexported fields
}

Server provides a bi-directional event stream with clients on top of named pipes.

func (*Server) Broadcast

func (s *Server) Broadcast(e Event) error

Broadcast broadcasts e to all connected clients.

func (*Server) Command

func (s *Server) Command(cmd string, h func(data interface{}) interface{})

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop() (err error)

Stop stops listening on the named pipe.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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