Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientCodec ¶
type ClientCodec struct { RingBufferCodec // 在proto序列化后的数据,再做一层编码 // encoder after proto.Message serialize ProtoPacketBytesEncoder func(protoPacketBytes [][]byte) [][]byte // 在proto反序列化之前,先做一层解码 // decoder before proto.Message deserialize ProtoPacketBytesDecoder func(packetData []byte) []byte // 消息号和proto.Message type的映射表 MessageCreatorMap map[PacketCommand]reflect.Type }
Tcp客户端和gate之间的编解码
func NewClientCodec ¶
func NewClientCodec() *ClientCodec
func (*ClientCodec) DecodePacket ¶
func (this *ClientCodec) DecodePacket(connection Connection, packetHeader PacketHeader, packetData []byte) Packet
func (*ClientCodec) EncodePacket ¶
func (this *ClientCodec) EncodePacket(connection Connection, packet Packet) [][]byte
func (*ClientCodec) Register ¶
func (this *ClientCodec) Register(command PacketCommand, protoMessage proto.Message)
注册消息和proto.Message的映射
protoMessage can be nil
type ClientConnectionHandler ¶
type ClientConnectionHandler struct {
DefaultConnectionHandler
}
客户端连接的handler
func NewClientConnectionHandler ¶
func NewClientConnectionHandler(protoCodec Codec) *ClientConnectionHandler
type ClientData ¶
客户端绑定数据
type ClientListerHandler ¶
type ClientListerHandler struct { }
客户端listener handler
func (*ClientListerHandler) OnConnectionConnected ¶
func (this *ClientListerHandler) OnConnectionConnected(listener Listener, acceptedConnection Connection)
func (*ClientListerHandler) OnConnectionDisconnect ¶
func (this *ClientListerHandler) OnConnectionDisconnect(listener Listener, connection Connection)
客户端断开连接
type GateServer ¶
type GateServer struct { BaseServer // contains filtered or unexported fields }
type GateServerConfig ¶
type GateServerConfig struct { BaseServerConfig // WebSocket测试 WsClientListenAddr string WsClientListenerConfig ListenerConfig }
gate服配置
type WsClientCodec ¶
type WsClientCodec struct {
SimpleProtoCodec
}
WebSocket客户端和gate之间的编解码
func NewWsClientCodec ¶
func NewWsClientCodec() *WsClientCodec
func (*WsClientCodec) Decode ¶
func (this *WsClientCodec) Decode(connection Connection, data []byte) (newPacket Packet, err error)
Click to show internal directories.
Click to hide internal directories.