Documentation ¶
Index ¶
- Constants
- Variables
- type Proto
- func (*Proto) Descriptor() ([]byte, []int)
- func (m *Proto) GetBody() []byte
- func (m *Proto) GetOp() int32
- func (m *Proto) GetSeq() int32
- func (m *Proto) GetVer() int32
- func (*Proto) ProtoMessage()
- func (p *Proto) ReadTCP(rr *bufio.Reader) (err error)
- func (p *Proto) ReadWebsocket(ws *websocket.Conn) (err error)
- func (m *Proto) Reset()
- func (m *Proto) String() string
- func (p *Proto) WriteTCP(wr *bufio.Writer) (err error)
- func (p *Proto) WriteTCPHeart(wr *bufio.Writer, online int32) (err error)
- func (p *Proto) WriteTo(b *bytes.Writer)
- func (p *Proto) WriteWebsocket(ws *websocket.Conn) (err error)
- func (p *Proto) WriteWebsocketHeart(wr *websocket.Conn, online int32) (err error)
- func (m *Proto) XXX_DiscardUnknown()
- func (m *Proto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Proto) XXX_Merge(src proto.Message)
- func (m *Proto) XXX_Size() int
- func (m *Proto) XXX_Unmarshal(b []byte) error
Constants ¶
View Source
const ( // OpHandshake handshake OpHandshake = int32(0) // OpHandshakeReply handshake reply OpHandshakeReply = int32(1) // OpHeartbeat heartbeat OpHeartbeat = int32(2) // OpHeartbeatReply heartbeat reply OpHeartbeatReply = int32(3) // OpSendMsg send message. OpSendMsg = int32(4) // OpSendMsgReply send message reply OpSendMsgReply = int32(5) // OpDisconnectReply disconnect reply OpDisconnectReply = int32(6) // OpAuth auth connnect OpAuth = int32(7) // OpAuthReply auth connect reply OpAuthReply = int32(8) // OpRaw raw message OpRaw = int32(9) // OpProtoReady proto ready OpProtoReady = int32(10) // OpProtoFinish proto finish OpProtoFinish = int32(11) // OpChangeRoom change room OpChangeRoom = int32(12) // OpChangeRoomReply change room reply OpChangeRoomReply = int32(13) // OpSub subscribe operation OpSub = int32(14) // OpSubReply subscribe operation OpSubReply = int32(15) // OpUnsub unsubscribe operation OpUnsub = int32(16) // OpUnsubReply unsubscribe operation reply OpUnsubReply = int32(17) )
View Source
const ( // MaxBodySize max proto body size MaxBodySize = int32(1 << 12) )
Variables ¶
View Source
var ( // ErrProtoPackLen proto packet len error ErrProtoPackLen = errors.New("default server codec pack length error") // ErrProtoHeaderLen proto header len error ErrProtoHeaderLen = errors.New("default server codec header length error") )
View Source
var ( // ProtoReady proto ready ProtoReady = &Proto{Op: OpProtoReady} // ProtoFinish proto finish ProtoFinish = &Proto{Op: OpProtoFinish} )
Functions ¶
This section is empty.
Types ¶
type Proto ¶
type Proto struct { Ver int32 `protobuf:"varint,1,opt,name=ver,proto3" json:"ver,omitempty"` Op int32 `protobuf:"varint,2,opt,name=op,proto3" json:"op,omitempty"` Seq int32 `protobuf:"varint,3,opt,name=seq,proto3" json:"seq,omitempty"` Body []byte `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
v1.0.0 protocol
func (*Proto) Descriptor ¶
func (*Proto) ProtoMessage ¶
func (*Proto) ProtoMessage()
func (*Proto) ReadWebsocket ¶
ReadWebsocket read a proto from websocket connection.
func (*Proto) WriteTCPHeart ¶
WriteTCPHeart write TCP heartbeat with room online.
func (*Proto) WriteWebsocket ¶
WriteWebsocket write a proto to websocket connection.
func (*Proto) WriteWebsocketHeart ¶
WriteWebsocketHeart write websocket heartbeat with room online.
func (*Proto) XXX_DiscardUnknown ¶
func (m *Proto) XXX_DiscardUnknown()
func (*Proto) XXX_Marshal ¶
func (*Proto) XXX_Unmarshal ¶
Click to show internal directories.
Click to hide internal directories.