Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrServerNotRunning = errors.New("server not listening")
Functions ¶
Types ¶
type HandlerFunc ¶
func (HandlerFunc[T, R]) Handle ¶
func (h HandlerFunc[T, R]) Handle(msg T) (R, error)
type MessageHandler ¶
MessageHandler defines an interface for processing a message of type T and returning a result of type R.
type SocketServer ¶
type SocketServer[T, R any] struct { // contains filtered or unexported fields }
func NewServer ¶
func NewServer[T, R any](address string, handler MessageHandler[T, R]) *SocketServer[T, R]
NewServer creates a new socket server instance listening on the provided address. The server will offload received messages to the handler for processing.
Click to show internal directories.
Click to hide internal directories.