Versions in this module Expand all Collapse all v0 v0.1.3 Apr 8, 2026 Changes in this version + func ContextAs[T any](sc *StreamContext) (T, bool) + func MustRegisterCodec(codec CodecImpl) struct + func MustRegisterGlobalType[T any]() struct + func RegisterCodec(codec CodecImpl) error + func RegisterGlobalType[T any]() error + func SendRecvAs[T any](v Link, msg Message) (T, error) + func WireNameOf(msg Message) (string, error) + type Client struct + func NewClient() *Client + func (c *Client) Connect(addr string) (*Connection, error) + func (c *Client) WithCodecs(codecs ...CodecID) *Client + func (c *Client) WithMaxFrame(maxFrame uint32) *Client + func (c *Client) WithRecovery(opts ClientRecoveryOptions) *Client + func (c *Client) WithTimeout(timeout time.Duration) *Client + type ClientRecoveryOptions struct + Enable bool + MaxReplayBytes int64 + ReconnectMaxBackoff time.Duration + ReconnectMinBackoff time.Duration + type CodecID byte + const CodecMsgpackCompact + const CodecMsgpackMap + func (c CodecID) String() string + type CodecImpl interface + DecodeEnvelope func([]byte) (Envelope, error) + DecodeInto func(body any, dst any) error + Encode func(Message) ([]byte, error) + ID func() CodecID + Name func() string + type Connection struct + func (c *Connection) Close() + func (c *Connection) DebugState() ConnectionDebugState + func (c *Connection) NewStream() *Stream[Message] + func (c *Connection) PeekWire() (string, error) + func (c *Connection) Recv() (Message, error) + func (c *Connection) Send(msg Message) error + func (c *Connection) SendRecv(msg Message) (Message, error) + func (c *Connection) SetRecvTimeout(timeout time.Duration) + func (c *Connection) WaitClosed() + type ConnectionCounters struct + BytesRead uint64 + BytesWritten uint64 + ControlFramesRead uint64 + ControlFramesWritten uint64 + DataMessagesReceived uint64 + DataMessagesSent uint64 + DecodeErrors uint64 + FramesRead uint64 + FramesWritten uint64 + HandlerCalls uint64 + HandlerErrors uint64 + ProtocolErrorReplySendFailure uint64 + ProtocolErrors uint64 + ReconnectAttempts uint64 + ReconnectFailures uint64 + ReconnectSuccesses uint64 + RemoteErrors uint64 + StreamsClosed uint64 + StreamsOpened uint64 + TransportAttaches uint64 + TransportDetaches uint64 + type ConnectionDebugState struct + Closed bool + CodecID CodecID + CodecName string + Counters ConnectionCounters + LastFailure string + LastFailureAt time.Time + LastFailureCode DebugFailureCode + MaxFrame uint32 + NextSendSeq uint64 + Protocol byte + Recovery *RecoveryDebugState + StreamCount int + Streams []StreamDebugState + type DebugFailureCode string + const DebugFailureHandler + const DebugFailureNone + const DebugFailureReaderEnqueue + const DebugFailureReaderLoop + const DebugFailureReconnectResume + const DebugFailureReconnectTerminal + const DebugFailureRecoveryAckWrite + const DebugFailureRecoveryControl + const DebugFailureRecoveryData + const DebugFailureRecoveryLiveWrite + const DebugFailureRecoveryPingWrite + const DebugFailureRecoveryRead + const DebugFailureRecoveryResumeWrite + const DebugFailureStreamDecode + const DebugFailureStreamEncode + const DebugFailureStreamEnqueue + const DebugFailureStreamProtocol + const DebugFailureStreamProtocolReplySend + const DebugFailureStreamRecvTimeout + const DebugFailureWriterLoop + type Envelope struct + Body any + Wire string + type ErrBadHandshakeMagic struct + func (e ErrBadHandshakeMagic) Error() string + type ErrClosed struct + func (e ErrClosed) Error() string + type ErrCodec struct + Message string + func (e ErrCodec) Error() string + type ErrCompactFieldCount struct + Expected int + Got int + func (e ErrCompactFieldCount) Error() string + type ErrConcurrentRecv struct + func (e ErrConcurrentRecv) Error() string + type ErrConnectTimeout struct + func (e ErrConnectTimeout) Error() string + type ErrFrameTooLarge struct + Size int + func (e ErrFrameTooLarge) Error() string + type ErrHandlerTaskBusy struct + func (e ErrHandlerTaskBusy) Error() string + type ErrHandshakeRejected struct + func (e ErrHandshakeRejected) Error() string + type ErrInvalidMessage struct + Reason string + func (e ErrInvalidMessage) Error() string + type ErrNoCommonCodec struct + func (e ErrNoCommonCodec) Error() string + type ErrNoCommonVersion struct + ClientMax byte + ClientMin byte + ServerMax byte + ServerMin byte + func (e ErrNoCommonVersion) Error() string + type ErrRecvTimeout struct + func (e ErrRecvTimeout) Error() string + type ErrRemote struct + Code string + Message string + func (e ErrRemote) Error() string + type ErrReplayBufferFull struct + Limit int64 + Size int64 + func (e ErrReplayBufferFull) Error() string + type ErrResumeRejected struct + Reason string + func (e ErrResumeRejected) Error() string + type ErrTooManyCodecs struct + Count int + func (e ErrTooManyCodecs) Error() string + type ErrTypeMismatch struct + Expected string + Got string + func (e ErrTypeMismatch) Error() string + type ErrUnknownMessage struct + Name string + func (e ErrUnknownMessage) Error() string + type ErrUnsupportedCodec struct + Value byte + func (e ErrUnsupportedCodec) Error() string + type ErrUnsupportedFrameVersion struct + Version byte + func (e ErrUnsupportedFrameVersion) Error() string + type ErrUnsupportedTransport struct + Reason string + func (e ErrUnsupportedTransport) Error() string + type ErrorReply struct + Code string + Message string + func NewErrorReply(code, message string) *ErrorReply + func (*ErrorReply) WireName() string + type Link interface + type Message interface + type NamedMessage interface + WireName func() string + type Netconn struct + func (n Netconn) PeerAddr() string + type OkReply struct + func (*OkReply) WireName() string + type OnceConn struct + func Once(addr string) *OnceConn + func (o *OnceConn) WithCodecs(codecs ...CodecID) *OnceConn + func (o *OnceConn) WithTimeout(d time.Duration) *OnceConn + type RecoveryDebugState struct + AckDelay time.Duration + AckDue bool + AckEvery uint32 + AckPending uint32 + ConnectionID string + HeartbeatInterval time.Duration + HeartbeatTimeout time.Duration + LastAckedSeq uint64 + LastRecvSeq uint64 + LiveQueueDepth int + ReconnectActive bool + ReplayBytes int64 + ReplayQueued int + ResumeQueueDepth int + Role string + TransportAttached bool + TransportGen uint64 + type Server struct + func NewServer() *Server + func (s *Server) OnCloseStream(f func(*StreamContext)) *Server + func (s *Server) OnConnect(f func(Netconn) error) *Server + func (s *Server) OnDisconnect(f func(Netconn) error) *Server + func (s *Server) OnNewStream(f func(*StreamContext)) *Server + func (s *Server) Serve(addr string) error + func (s *Server) WithCodecs(codecs ...CodecID) *Server + func (s *Server) WithRecovery(opts ServerRecoveryOptions) *Server + type ServerRecoveryOptions struct + AckDelay time.Duration + AckEvery uint32 + DetachedTTL time.Duration + Enable bool + HeartbeatInterval time.Duration + HeartbeatTimeout time.Duration + MaxReplayBytes int64 + type Stream struct + func StreamAs[T any](v Link) *Stream[T] + func (s *Stream[T]) Close() + func (s *Stream[T]) DebugState() StreamDebugState + func (s *Stream[T]) ID() uint32 + func (s *Stream[T]) PeekWire() (string, error) + func (s *Stream[T]) Recv() (T, error) + func (s *Stream[T]) Send(msg Message) error + func (s *Stream[T]) SendRecv(msg Message) (T, error) + func (s *Stream[T]) SetRecvTimeout(timeout time.Duration) + type StreamContext struct + func (sc *StreamContext) GetContext() any + func (sc *StreamContext) NewTask(fn func(*Stream[Message])) error + func (sc *StreamContext) SetContext(value any) + type StreamCounters struct + DataMessagesReceived uint64 + DataMessagesSent uint64 + DecodeErrors uint64 + HandlerCalls uint64 + HandlerErrors uint64 + ProtocolErrorReplySendFailure uint64 + ProtocolErrors uint64 + RemoteErrors uint64 + type StreamDebugState struct + Closed bool + Counters StreamCounters + HandlerQDepth int + ID uint32 + InboxDepth int + IncomingDepth int + LastFailure string + LastFailureAt time.Time + LastFailureCode DebugFailureCode + RecvTimeout time.Duration v0.1.2 Apr 7, 2026 v0.1.1 Apr 5, 2026 v0.1.0 Apr 4, 2026