1st ver
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package types
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
const (
|
||||
CMD_SUB = "sub"
|
||||
CMD_UNSUB = "unsub"
|
||||
CMD_PUB = "pub"
|
||||
CMD_RPC = "rpc"
|
||||
CMD_RPCREPLY = "rpcreply"
|
||||
CMD_CLOSE = "close"
|
||||
)
|
||||
|
||||
type Msg struct {
|
||||
Cmd string `json:"cmd,omitempty"`
|
||||
Id string `json:"id,omitempty"`
|
||||
ReplyTo string `json:"reply_to,omitempty"`
|
||||
Topic string `json:"topic,omitempty"`
|
||||
Src string `json:"src,omitempty"`
|
||||
Header map[string]string `json:"header,omitempty"`
|
||||
Payload []byte `json:"payload,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Msg) Bytes() []byte {
|
||||
bs, _ := json.Marshal(m)
|
||||
return bs
|
||||
}
|
||||
Reference in New Issue
Block a user