Documentation ¶
Index ¶
- Constants
- Variables
- type AllRoomCountReply
- type AllServerCountReply
- type BoardcastArg
- type BoardcastRoomArg
- type ConnArg
- type ConnReply
- type CountReply
- type DelArg
- type DelReply
- type DelServerArg
- type DisconnArg
- type DisconnReply
- type GetAllReply
- type GetArg
- type GetReply
- type KafkaMsg
- type MGetArg
- type MGetReply
- type MPushMsgArg
- type MPushMsgReply
- type MPushMsgsArg
- type MPushMsgsReply
- type NoArg
- type NoReply
- type Proto
- func (p *Proto) ReadTCP(rr *bufio.Reader) (err error)
- func (p *Proto) ReadWebsocket(wr *websocket.Conn) (err error)
- func (p *Proto) Reset()
- func (p *Proto) String() string
- func (p *Proto) WriteBodyTo(b *bytes.Writer) (err error)
- func (p *Proto) WriteTCP(wr *bufio.Writer) (err error)
- func (p *Proto) WriteTo(b *bytes.Writer)
- func (p *Proto) WriteWebsocket(wr *websocket.Conn) (err error)
- type PushMsgArg
- type PushMsgsArg
- type PushMsgsReply
- type PutArg
- type PutReply
- type RoomCountArg
- type RoomCountReply
- type RoomsReply
- type UserCountArg
- type UserCountReply
Constants ¶
View Source
const ( // size PackSize = 4 HeaderSize = 2 VerSize = 2 OperationSize = 4 SeqIdSize = 4 RawHeaderSize = PackSize + HeaderSize + VerSize + OperationSize + SeqIdSize MaxPackSize = MaxBodySize + int32(RawHeaderSize) // offset PackOffset = 0 HeaderOffset = PackOffset + PackSize VerOffset = HeaderOffset + HeaderSize OperationOffset = VerOffset + VerSize SeqIdOffset = OperationOffset + OperationSize )
View Source
const (
MaxBodySize = int32(1 << 10)
)
for tcp
Variables ¶
View Source
var ( ErrProtoPackLen = errors.New("default server codec pack length error") ErrProtoHeaderLen = errors.New("default server codec header length error") )
View Source
var ( ProtoReady = &Proto{Operation: define.OP_PROTO_READY} ProtoFinish = &Proto{Operation: define.OP_PROTO_FINISH} )
Functions ¶
This section is empty.
Types ¶
type AllRoomCountReply ¶
type AllServerCountReply ¶
type BoardcastArg ¶
type BoardcastArg struct {
P Proto
}
type BoardcastRoomArg ¶
type CountReply ¶
type CountReply struct {
Count int32
}
type DelServerArg ¶
type DelServerArg struct {
Server int32
}
type DisconnArg ¶
type DisconnReply ¶
type DisconnReply struct {
Has bool
}
type GetAllReply ¶
type KafkaMsg ¶
type KafkaMsg struct { OP string `json:"op"` RoomId int32 `json:"roomid,omitempty"` ServerId int32 `json:"server,omitempty"` SubKeys []string `json:"subkeys,omitempty"` Msg []byte `json:"msg"` Ensure bool `json:"ensure,omitempty"` }
TODO optimize struct after replace kafka
type MPushMsgArg ¶
type MPushMsgReply ¶
type MPushMsgReply struct {
Index int32
}
type MPushMsgsArg ¶
type MPushMsgsArg struct {
PMArgs []*PushMsgArg
}
type MPushMsgsReply ¶
type MPushMsgsReply struct {
Index int32
}
type Proto ¶
type Proto struct { Ver int16 `json:"ver"` // protocol version Operation int32 `json:"op"` // operation for request SeqId int32 `json:"seq"` // sequence number chosen by client Body json.RawMessage `json:"body"` // binary body bytes(json.RawMessage is []byte) }
Proto is a request&response written before every goim connect. It is used internally but documented here as an aid to debugging, such as when analyzing network traffic. tcp: binary codec websocket & http: raw codec, with http header stored ver, operation, seqid
type PushMsgArg ¶
type PushMsgsArg ¶
type PushMsgsArg struct { Key string PMArgs []*PushMsgArg }
type PushMsgsReply ¶
type PushMsgsReply struct {
Index int32
}
type RoomCountArg ¶
type RoomCountArg struct {
RoomId int32
}
type RoomCountReply ¶
type RoomCountReply struct {
Count int32
}
type RoomsReply ¶
type RoomsReply struct {
RoomIds map[int32]struct{}
}
type UserCountArg ¶
type UserCountArg struct {
UserId int64
}
type UserCountReply ¶
type UserCountReply struct {
Count int32
}
Click to show internal directories.
Click to hide internal directories.