blob: c17d153b4ddcfaed49d32dae828d7e2f1dfdfc7e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package pubsub
import (
json "github.com/json-iterator/go"
)
type Message struct {
// Command (join, leave, headers)
Command string `json:"command"`
// Broker (redis, memory)
Broker string `json:"broker"`
// Topic message been pushed into.
Topics []string `json:"topic"`
// Payload to be broadcasted
Payload []byte `json:"payload"`
}
// MarshalBinary needed to marshal message for the redis
func (m *Message) MarshalBinary() ([]byte, error) {
return json.Marshal(m)
}
|