Documentation
¶
Overview ¶
Package msg provides message types and codecs for event-based communication.
Index ¶
Constants ¶
View Source
const (
// Delimiter is the separator used between event name, ack ID, and data.
Delimiter = "||"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Codec ¶ added in v4.1.0
type Codec interface {
// UnmarshalEvent decodes event data from bytes.
UnmarshalEvent(data []byte) (Event, error)
// EncodeEvent encodes an event to bytes.
EncodeEvent(w *bytes.Buffer, event Event) error
}
Codec defines an interface for encoding and decoding events.
type Event ¶
Event represents a communication event with a name, optional acknowledgment ID, and data payload.
func (Event) IsAckRequired ¶
IsAckRequired returns true if the event requires an acknowledgment.
type LineCodec ¶ added in v4.1.0
type LineCodec struct{}
LineCodec is a simple text-based codec that uses "||" as a delimiter. The format is: <eventName>||<ackId>||<eventData>
func NewLineCodec ¶ added in v4.1.0
func NewLineCodec() LineCodec
NewLineCodec creates a new LineCodec instance.
func (LineCodec) EncodeEvent ¶ added in v4.1.0
EncodeEvent encodes an event to the line-based format.
Click to show internal directories.
Click to hide internal directories.