Documentation ¶
Index ¶
- Constants
- Variables
- type AcceptClient
- type Client
- type Event
- type MessageType
- type Request
- type Response
- func (*Response) Descriptor() ([]byte, []int)deprecated
- func (x *Response) GetBody() []byte
- func (x *Response) GetId() int32
- func (x *Response) GetStatus() int32
- func (x *Response) GetTag() int32
- func (x *Response) GetType() int32
- func (*Response) ProtoMessage()
- func (x *Response) ProtoReflect() protoreflect.Message
- func (x *Response) Reset()
- func (x *Response) String() string
- type Server
Constants ¶
View Source
const ( MessageTypeData = MessageType(iota) MessageTypePing MessageTypePong )
Variables ¶
View Source
var ( ErrorMessageFormatInvalid = errors.New("message format invalid") ErrorConnectIdInvalid = errors.New("connect id invalid") ErrorConnectionInvalid = errors.New("connection invalid") )
View Source
var File_message_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type AcceptClient ¶
type AcceptClient struct {
// contains filtered or unexported fields
}
type Client ¶
type Client struct { OnConnected func() OnClose func() OnData func(tag uint32, payload []byte) // contains filtered or unexported fields }
func (*Client) DialAndServe ¶
type MessageType ¶
type MessageType uint8
type Request ¶
type Request struct { Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // 请求 id Tag int32 `protobuf:"varint,2,opt,name=tag,proto3" json:"tag,omitempty"` // tag Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` // 消息体 // contains filtered or unexported fields }
func (*Request) Descriptor
deprecated
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶
func (x *Request) ProtoReflect() protoreflect.Message
type Response ¶
type Response struct { Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // 回复对应的请求 id Tag int32 `protobuf:"varint,2,opt,name=tag,proto3" json:"tag,omitempty"` // tag Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` // 消息体 Status int32 `protobuf:"varint,4,opt,name=status,proto3" json:"status,omitempty"` // 处理消息的状态码 Type int32 `protobuf:"varint,5,opt,name=type,proto3" json:"type,omitempty"` // 消息类型, 0 普通, 1 推送 // contains filtered or unexported fields }
func (*Response) Descriptor
deprecated
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message
Click to show internal directories.
Click to hide internal directories.