Documentation ¶
Index ¶
- Constants
- Variables
- func Http(tag string, cmds []string)
- func Log(tag, id string, args ...interface{})
- type AccountInfo
- type ChatroomService
- func (this *ChatroomService) GetMultiInfo(args []string)
- func (this *ChatroomService) HandleGetMessage(msg *UserMessage) bool
- func (this *ChatroomService) HandleServiceMessage(data []byte, sn uint64, source int) bool
- func (this *ChatroomService) Join(args []string) bool
- func (this *ChatroomService) Query(args []string) bool
- func (this *ChatroomService) Quit(args []string) bool
- type ClientConf
- type GroupService
- func (gs *GroupService) GetMsg(groupid string, startid uint64, offset int32) bool
- func (gs *GroupService) GetMsgBatch(ids []int64) bool
- func (gs *GroupService) HandleGetMessage(msg *UserMessage) bool
- func (gs *GroupService) HandleServiceMessage(data []byte, sn uint64, source int) bool
- func (gs *GroupService) Sync() bool
- type MessageSlot
- type ServiceHandler
- type Stream
- type TcpStream
- type UserConnection
- type UserMessage
- type WebSocketStream
Constants ¶
View Source
const ( ChatroomServiceID = 10000006 PayloadQuery = 101 // 查询聊天室信息 PayloadJoin = 102 // 加入聊天室 PayloadQuit = 103 // 退出聊天室 PayloadIncomingMsg = 1000 // 消息通知 PayloadCompressed = 1003 // 压缩消息 )
View Source
const ( StateIdle = iota StateRunning StateInitiated StateLoggedIn )
View Source
const ( Tcp = "tcp" WebSocket = "ws" ConnTimeout = 5 WriteTimeout = 20 RequestTimeout = 30 ClientChanLen = 100 )
View Source
const ( IM = "im" Peer = "peer" Public = "public" ChatRoom = "chatroom" )
View Source
const (
GroupServiceID = 10000001
)
Variables ¶
View Source
var (
PingData = []byte{0, 0, 0, 0}
)
Functions ¶
Types ¶
type AccountInfo ¶
type ChatroomService ¶
type ChatroomService struct {
// contains filtered or unexported fields
}
func (*ChatroomService) GetMultiInfo ¶
func (this *ChatroomService) GetMultiInfo(args []string)
func (*ChatroomService) HandleGetMessage ¶
func (this *ChatroomService) HandleGetMessage(msg *UserMessage) bool
func (*ChatroomService) HandleServiceMessage ¶
func (this *ChatroomService) HandleServiceMessage(data []byte, sn uint64, source int) bool
func (*ChatroomService) Join ¶
func (this *ChatroomService) Join(args []string) bool
func (*ChatroomService) Query ¶
func (this *ChatroomService) Query(args []string) bool
func (*ChatroomService) Quit ¶
func (this *ChatroomService) Quit(args []string) bool
type ClientConf ¶
type ClientConf struct { Tag string ConnType string // Connection Type: "tcp" or "websocket" ServerAddr string // Server address CenterAddr string // Center address AppID uint32 // ApplicationID ClientVer int // ClientVersion ProtoVer int // ProtocolVersion DefaultKey string // Default Key Heartbeat int // Heartbeat interval (unit second) SendHeartbeat int // Send heart beat or not, if value is 0, don't send, otherwise send. AutoLogin int // autologin when init login, if the value is not 0 }
type GroupService ¶
type GroupService struct {
// contains filtered or unexported fields
}
func (*GroupService) GetMsg ¶
func (gs *GroupService) GetMsg(groupid string, startid uint64, offset int32) bool
func (*GroupService) GetMsgBatch ¶
func (gs *GroupService) GetMsgBatch(ids []int64) bool
func (*GroupService) HandleGetMessage ¶
func (gs *GroupService) HandleGetMessage(msg *UserMessage) bool
func (*GroupService) HandleServiceMessage ¶
func (gs *GroupService) HandleServiceMessage(data []byte, sn uint64, source int) bool
func (*GroupService) Sync ¶
func (gs *GroupService) Sync() bool
type MessageSlot ¶
type ServiceHandler ¶
type UserConnection ¶
type UserConnection struct { CmdChan chan []string // export // contains filtered or unexported fields }
func NewUserConnection ¶
func NewUserConnection(c *ClientConf, a *AccountInfo, v bool) *UserConnection
func (*UserConnection) RequestService ¶
func (c *UserConnection) RequestService(serviceID int, data []byte) bool
func (*UserConnection) Start ¶
func (c *UserConnection) Start(ch chan string)
type UserMessage ¶
type WebSocketStream ¶
type WebSocketStream struct {
// contains filtered or unexported fields
}
func NewWebSocketStream ¶
func NewWebSocketStream(addr string, timeout time.Duration) (*WebSocketStream, error)
func (*WebSocketStream) Close ¶
func (ws *WebSocketStream) Close()
func (*WebSocketStream) SetReadDeadline ¶
func (ws *WebSocketStream) SetReadDeadline(t time.Time) error
func (*WebSocketStream) SetWriteDeadline ¶
func (ws *WebSocketStream) SetWriteDeadline(t time.Time) error
Click to show internal directories.
Click to hide internal directories.