MCPcopy
hub / github.com/davyxu/cellnet / Message

Method Message

session.go:28–48  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26}
27
28func (self *RawPacket) Message() interface{} {
29
30 // 获取消息元信息
31 meta := MessageMetaByID(self.MsgID)
32
33 // 消息没有注册
34 if meta == nil {
35 return struct{}{}
36 }
37
38 // 创建消息
39 msg := meta.NewType()
40
41 // 从字节数组转换为消息
42 err := meta.Codec.Decode(self.MsgData, msg)
43 if err != nil {
44 return struct{}{}
45 }
46
47 return msg
48}

Callers

nothing calls this directly

Calls 3

MessageMetaByIDFunction · 0.85
NewTypeMethod · 0.80
DecodeMethod · 0.65

Tested by

no test coverage detected