service

package
v0.0.0-...-e643149 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNameAlreadyRegistered = errors.New("service already registered")
	ErrTooManyServices       = errors.New("too many services")
)

Registration failure reasons.

Functions

This section is empty.

Types

type Service

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

Service handle.

If a stream is opened as a result of service registration or a call, the appropriate stream constructor must be called synchronously in the receptor function.

func MustRegister

func MustRegister(name string, infoReceptor func([]byte)) *Service

MustRegister a service or panic. The info receptor is invoked with info packets' content.

func Register

func Register(name string, infoReceptor func([]byte)) (*Service, error)

Register a service. The info receptor is invoked with info packets' content.

func (*Service) Call

func (s *Service) Call(content []byte, receptor func([]byte))

Call the service. The receptor is invoked once with the reply packet content.

func (*Service) Code

func (s *Service) Code() int16

func (*Service) NewStream

func (s *Service) NewStream(id int32) io.ReadWriteCloser

NewStream constructs a handle to a new bidirectional stream.

func (*Service) SendInfo

func (s *Service) SendInfo(content []byte)

SendInfo to the service.

Jump to

Keyboard shortcuts

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