Documentation ¶
Index ¶
Constants ¶
View Source
const (
// PayloadName defines the name of the chat payload.
PayloadName = "chat"
)
Variables ¶
View Source
var Type = payload.NewType(payloadType, PayloadName, func(data []byte) (payload payload.Payload, err error) { var consumedBytes int payload, consumedBytes, err = FromBytes(data) if err != nil { return nil, err } if consumedBytes != len(data) { return nil, errors.New("not all payload bytes were consumed") } return })
Type represents the identifier which addresses the chat payload type.
Functions ¶
This section is empty.
Types ¶
type Payload ¶
type Payload struct { From string FromLen uint32 To string ToLen uint32 Message string MessageLen uint32 // contains filtered or unexported fields }
Payload represents the chat payload type.
func FromBytes ¶
FromBytes parses the marshaled version of a Payload into a Go object. It either returns a new Payload or fills an optionally provided Payload with the parsed information.
func NewPayload ¶
NewPayload creates a new chat payload.
func Parse ¶
func Parse(marshalUtil *marshalutil.MarshalUtil) (result *Payload, err error)
Parse unmarshals an Payload using the given marshalUtil (for easier marshaling/unmarshaling).
Click to show internal directories.
Click to hide internal directories.