Documentation ¶
Index ¶
- Variables
- func Register(fmt Type, codec Serializer)
- type Error
- type IWrapper
- type JSBuffer
- type JSONWrapper
- type MessagePackJSWrapper
- type MessagePackWrapper
- func (z *MessagePackWrapper) DecodeMsg(dc *msgp.Reader) (err error)
- func (z MessagePackWrapper) EncodeMsg(en *msgp.Writer) (err error)
- func (w MessagePackWrapper) GetData() []byte
- func (w MessagePackWrapper) GetType() string
- func (z MessagePackWrapper) MarshalMsg(b []byte) (o []byte, err error)
- func (z MessagePackWrapper) Msgsize() (s int)
- func (z *MessagePackWrapper) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Ping
- func (*Ping) Descriptor() ([]byte, []int)
- func (m *Ping) Marshal() (dAtA []byte, err error)
- func (m *Ping) MarshalTo(dAtA []byte) (int, error)
- func (m *Ping) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Ping) ProtoMessage()
- func (m *Ping) Reset()
- func (m *Ping) Size() (n int)
- func (m *Ping) String() string
- func (m *Ping) Unmarshal(dAtA []byte) error
- func (m *Ping) XXX_DiscardUnknown()
- func (m *Ping) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Ping) XXX_Merge(src proto.Message)
- func (m *Ping) XXX_Size() int
- func (m *Ping) XXX_Unmarshal(b []byte) error
- type Pong
- func (*Pong) Descriptor() ([]byte, []int)
- func (m *Pong) Marshal() (dAtA []byte, err error)
- func (m *Pong) MarshalTo(dAtA []byte) (int, error)
- func (m *Pong) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Pong) ProtoMessage()
- func (m *Pong) Reset()
- func (m *Pong) Size() (n int)
- func (m *Pong) String() string
- func (m *Pong) Unmarshal(dAtA []byte) error
- func (m *Pong) XXX_DiscardUnknown()
- func (m *Pong) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Pong) XXX_Merge(src proto.Message)
- func (m *Pong) XXX_Size() int
- func (m *Pong) XXX_Unmarshal(b []byte) error
- type ProtoWarpper
- func (*ProtoWarpper) Descriptor() ([]byte, []int)
- func (m *ProtoWarpper) Marshal() (dAtA []byte, err error)
- func (m *ProtoWarpper) MarshalTo(dAtA []byte) (int, error)
- func (m *ProtoWarpper) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ProtoWarpper) ProtoMessage()
- func (m *ProtoWarpper) Reset()
- func (m *ProtoWarpper) Size() (n int)
- func (m *ProtoWarpper) String() string
- func (m *ProtoWarpper) Unmarshal(dAtA []byte) error
- func (m *ProtoWarpper) XXX_DiscardUnknown()
- func (m *ProtoWarpper) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ProtoWarpper) XXX_Merge(src proto.Message)
- func (m *ProtoWarpper) XXX_Size() int
- func (m *ProtoWarpper) XXX_Unmarshal(b []byte) error
- type SerialJSON
- type SerialMessagePack
- func (z *SerialMessagePack) DecodeMsg(dc *msgp.Reader) (err error)
- func (z SerialMessagePack) EncodeMsg(en *msgp.Writer) (err error)
- func (c SerialMessagePack) Marshal(val interface{}) []byte
- func (c SerialMessagePack) MarshalBody(val interface{}) []byte
- func (z SerialMessagePack) MarshalMsg(b []byte) (o []byte, err error)
- func (z SerialMessagePack) Msgsize() (s int)
- func (c SerialMessagePack) Unmarshal(data []byte, val interface{}) error
- func (z *SerialMessagePack) UnmarshalMsg(bts []byte) (o []byte, err error)
- func (c SerialMessagePack) Unpack(format Type, data []byte) (string, []byte)
- type SerialProtobuf
- type Serializer
- type Type
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type JSBuffer ¶
type JSBuffer []byte
JSBuffer JavaScript的Buffer类型
func (*JSBuffer) ExtensionType ¶
func (*JSBuffer) MarshalBinaryTo ¶
MarshalMsgpack 序列化JSBuffer
func (*JSBuffer) UnmarshalBinary ¶
UnmarshalMsgpack 反序列化JSBuffer
type JSONWrapper ¶
type JSONWrapper struct { Type string `json:"type"` Data interface{} `json:"data,omitempty"` Code *int `json:"code,omitempty"` Msg *string `json:"msg,omitempty"` }
JSONWrapper 消息外包装
type MessagePackJSWrapper ¶
MessagePackJSWrapper 消息外包装
type MessagePackWrapper ¶
MessagePackWrapper 消息外包装
func (*MessagePackWrapper) DecodeMsg ¶
func (z *MessagePackWrapper) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (MessagePackWrapper) EncodeMsg ¶
func (z MessagePackWrapper) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (MessagePackWrapper) MarshalMsg ¶
func (z MessagePackWrapper) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (MessagePackWrapper) Msgsize ¶
func (z MessagePackWrapper) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*MessagePackWrapper) UnmarshalMsg ¶
func (z *MessagePackWrapper) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Ping ¶
type Ping struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
心跳检测,收到时回 Pong
func (*Ping) Descriptor ¶
func (*Ping) ProtoMessage ¶
func (*Ping) ProtoMessage()
func (*Ping) XXX_DiscardUnknown ¶
func (m *Ping) XXX_DiscardUnknown()
func (*Ping) XXX_Unmarshal ¶
type Pong ¶
type Pong struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
心跳检测,收到 Ping 时发送
func (*Pong) Descriptor ¶
func (*Pong) ProtoMessage ¶
func (*Pong) ProtoMessage()
func (*Pong) XXX_DiscardUnknown ¶
func (m *Pong) XXX_DiscardUnknown()
func (*Pong) XXX_Unmarshal ¶
type ProtoWarpper ¶
type ProtoWarpper struct { // 消息名 Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // 消息正文数据 Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
消息统一外包装
func (*ProtoWarpper) Descriptor ¶
func (*ProtoWarpper) Descriptor() ([]byte, []int)
func (*ProtoWarpper) Marshal ¶
func (m *ProtoWarpper) Marshal() (dAtA []byte, err error)
func (*ProtoWarpper) MarshalToSizedBuffer ¶
func (m *ProtoWarpper) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*ProtoWarpper) ProtoMessage ¶
func (*ProtoWarpper) ProtoMessage()
func (*ProtoWarpper) Reset ¶
func (m *ProtoWarpper) Reset()
func (*ProtoWarpper) Size ¶
func (m *ProtoWarpper) Size() (n int)
func (*ProtoWarpper) String ¶
func (m *ProtoWarpper) String() string
func (*ProtoWarpper) Unmarshal ¶
func (m *ProtoWarpper) Unmarshal(dAtA []byte) error
func (*ProtoWarpper) XXX_DiscardUnknown ¶
func (m *ProtoWarpper) XXX_DiscardUnknown()
func (*ProtoWarpper) XXX_Marshal ¶
func (m *ProtoWarpper) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ProtoWarpper) XXX_Merge ¶
func (m *ProtoWarpper) XXX_Merge(src proto.Message)
func (*ProtoWarpper) XXX_Size ¶
func (m *ProtoWarpper) XXX_Size() int
func (*ProtoWarpper) XXX_Unmarshal ¶
func (m *ProtoWarpper) XXX_Unmarshal(b []byte) error
type SerialJSON ¶
type SerialJSON struct{}
SerialJSON 序列化JSON
func (SerialJSON) MarshalBody ¶
func (c SerialJSON) MarshalBody(val interface{}) []byte
func (SerialJSON) Unmarshal ¶
func (c SerialJSON) Unmarshal(data []byte, val interface{}) error
Unmarshal 反序列化
type SerialMessagePack ¶
type SerialMessagePack struct{}
SerialMessagePack 序列化MessagePack
func (*SerialMessagePack) DecodeMsg ¶
func (z *SerialMessagePack) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (SerialMessagePack) EncodeMsg ¶
func (z SerialMessagePack) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (SerialMessagePack) Marshal ¶
func (c SerialMessagePack) Marshal(val interface{}) []byte
Marshal 序列化
func (SerialMessagePack) MarshalBody ¶
func (c SerialMessagePack) MarshalBody(val interface{}) []byte
func (SerialMessagePack) MarshalMsg ¶
func (z SerialMessagePack) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (SerialMessagePack) Msgsize ¶
func (z SerialMessagePack) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (SerialMessagePack) Unmarshal ¶
func (c SerialMessagePack) Unmarshal(data []byte, val interface{}) error
Unmarshal 反序列化
func (*SerialMessagePack) UnmarshalMsg ¶
func (z *SerialMessagePack) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type SerialProtobuf ¶
type SerialProtobuf struct{}
SerialProtobuf 序列化protobuf
func (SerialProtobuf) MarshalBody ¶
func (c SerialProtobuf) MarshalBody(val interface{}) []byte
func (SerialProtobuf) Unmarshal ¶
func (c SerialProtobuf) Unmarshal(data []byte, val interface{}) error
Unmarshal 反序列化