Browse Source

protocol/packet: json field names, settable body

Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
bboozzoo/golang
Maciek Borzecki 7 years ago
parent
commit
19f3aea2dd
1 changed files with 11 additions and 3 deletions
  1. +11
    -3
      protocol/packet/packet.go

+ 11
- 3
protocol/packet/packet.go View File

@ -16,7 +16,15 @@ import (
) )
type Packet struct { type Packet struct {
Id uint64
Type string
Body json.RawMessage
Id uint64 `json:"id"`
Type string `json:"type"`
Body json.RawMessage `json:"body"`
auxBody interface{}
}
func New(typ string, body interface{}) *Packet {
return &Packet{
Type: typ,
auxBody: body,
}
} }

Loading…
Cancel
Save