Documentation
¶
Index ¶
- type JsonCodec
- type Packet
- func (p *Packet) GetEventName() string
- func (p *Packet) GetType() socketcrutch.PacketType
- func (p *Packet) ID() int
- func (v Packet) Marshal() ([]byte, error)
- func (v Packet) MarshalEasyJSON(w *jwriter.Writer)
- func (p *Packet) Payload() []byte
- func (p *Packet) SetEventName(name string)
- func (p *Packet) SetID(id int)
- func (p *Packet) SetPayload(payload []byte)
- func (p *Packet) SetType(pType socketcrutch.PacketType)
- func (v *Packet) Unmarshal(data []byte) error
- func (v *Packet) UnmarshalEasyJSON(l *jlexer.Lexer)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JsonCodec ¶
type JsonCodec struct{}
func (*JsonCodec) NewPacket ¶
func (_ *JsonCodec) NewPacket() socketcrutch.Packet
type Packet ¶
type Packet struct { Type byte `json:"type"` Id int `json:"id"` Event string `json:"event"` Data []byte `json:"payload"` }
packet is container for raw data and therefore holds the event name, the pointer to payload, the event type id, the packet id.
func (*Packet) GetEventName ¶
func (*Packet) GetType ¶
func (p *Packet) GetType() socketcrutch.PacketType
func (Packet) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (*Packet) SetEventName ¶
func (*Packet) SetPayload ¶
func (*Packet) SetType ¶
func (p *Packet) SetType(pType socketcrutch.PacketType)
func (*Packet) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
Click to show internal directories.
Click to hide internal directories.