Documentation ¶
Index ¶
- func CheckHeartbeat(data []byte) (bool, error)
- func NewPacker(opts ...Option) *defaultPacker
- func PackBuffer(message *Message) (buffer.Buffer, error)
- func PackHeartbeat() ([]byte, error)
- func PackMessage(message *Message) ([]byte, error)
- func ReadMessage(reader interface{}) ([]byte, error)
- func SetPacker(packer Packer)
- type Message
- type NocopyReader
- type Option
- type Packer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckHeartbeat ¶ added in v2.1.0
CheckHeartbeat 检测心跳包
func PackBuffer ¶ added in v2.1.0
PackBuffer 打包消息
func PackMessage ¶ added in v2.1.0
PackMessage 打包消息
func ReadMessage ¶ added in v2.1.0
ReadMessage 读取消息
Types ¶
type Message ¶
func UnpackMessage ¶ added in v2.1.0
UnpackMessage 解包消息
type NocopyReader ¶ added in v2.1.0
type NocopyReader interface { // Next returns a slice containing the next n bytes from the buffer, // advancing the buffer as if the bytes had been returned by Read. Next(n int) (p []byte, err error) // Peek returns the next n bytes without advancing the reader. Peek(n int) (buf []byte, err error) // Release the memory space occupied by all read slices. Release() (err error) Slice(n int) (r NocopyReader, err error) }
type Option ¶
type Option func(o *options)
func WithHeartbeatTime ¶ added in v2.1.0
WithHeartbeatTime 是否携带心跳时间
type Packer ¶
type Packer interface { // ReadMessage 读取消息 ReadMessage(reader interface{}) ([]byte, error) // PackBuffer 打包消息 PackBuffer(message *Message) (buffer.Buffer, error) // PackMessage 打包消息 PackMessage(message *Message) ([]byte, error) // UnpackMessage 解包消息 UnpackMessage(data []byte) (*Message, error) // PackHeartbeat 打包心跳 PackHeartbeat() ([]byte, error) // CheckHeartbeat 检测心跳包 CheckHeartbeat(data []byte) (bool, error) }
Click to show internal directories.
Click to hide internal directories.