
The highest tagged major version is
v2.
package
Version:
v0.0.8
Opens a new window with list of versions in this module.
Published: Jan 18, 2022
License: MIT
Opens a new window with license information.
Imports: 4
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
type Event struct {
Topic string `json:"topic,omitempty" msgpack:"topic,omitempty"`
Sender string `json:"sender,omitempty" msgpack:"sender,omitempty"`
EventTime int64 `json:"event_time,omitempty" msgpack:"event_time,omitempty"`
EventID string `json:"event_id,omitempty" msgpack:"event_id,omitempty"`
Payload interface{} `json:"payload" msgpack:"payload"`
}
Event 消息对象
func DefaultParser(SerializeProtocol, topic, eventID, payloadstr string, payload map[string]interface{}) (*Event, error)
DefaultParser 默认的消息处理函数负载会被解析为 m,ap[string]interface{}
Handdler 处理消息的回调函数
@params msg *Event Event对象
type Parser func(SerializeProtocol, topic, eventID, payloadstr string, payload map[string]interface{}) (*Event, error)
Parser 用于将负载字符串转化为event的函数
规定eventID不为""时解析流的消息,用到topic, eventID, payload
规定eventID为""时解析除流之外的消息,用到SerializeProtocol,topic, payloadstr
Source Files
¶
Click to show internal directories.
Click to hide internal directories.