Documentation ¶
Index ¶
- Constants
- func Encode(msg *Message) ([]byte, error)
- type Conn
- type Message
- type Session
- func (s *Session) BindUserID(uid string)
- func (s *Session) GetConn() *Conn
- func (s *Session) GetSessionID() string
- func (s *Session) GetSetting(key string) interface{}
- func (s *Session) GetUserID() string
- func (s *Session) SetConn(conn *Conn)
- func (s *Session) SetSetting(key string, value interface{})
- type SocketService
- func (s *SocketService) Broadcast(msg *Message)
- func (s *SocketService) GetConnsCount() int
- func (s *SocketService) GetStatus() int
- func (s *SocketService) RegConnectHandler(handler func(*Session))
- func (s *SocketService) RegDisconnectHandler(handler func(*Session, error))
- func (s *SocketService) RegMessageHandler(handler func(*Session, *Message))
- func (s *SocketService) Serv()
- func (s *SocketService) SetHeartBeat(hbInterval time.Duration, hbTimeout time.Duration) error
- func (s *SocketService) Stop(reason string)
- func (s *SocketService) Unicast(sid string, msg *Message)
Constants ¶
View Source
const ( STUnknown = iota STInited STRunning STStop )
View Source
const (
MsgHeartbeat = iota
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) SendMessage ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶
func (*Session) BindUserID ¶
func (*Session) GetSessionID ¶
func (*Session) GetSetting ¶
func (*Session) SetSetting ¶
type SocketService ¶
type SocketService struct {
// contains filtered or unexported fields
}
func NewSocketService ¶
func NewSocketService(laddr string) (*SocketService, error)
func (*SocketService) Broadcast ¶
func (s *SocketService) Broadcast(msg *Message)
func (*SocketService) GetConnsCount ¶
func (s *SocketService) GetConnsCount() int
func (*SocketService) GetStatus ¶
func (s *SocketService) GetStatus() int
func (*SocketService) RegConnectHandler ¶
func (s *SocketService) RegConnectHandler(handler func(*Session))
func (*SocketService) RegDisconnectHandler ¶
func (s *SocketService) RegDisconnectHandler(handler func(*Session, error))
func (*SocketService) RegMessageHandler ¶
func (s *SocketService) RegMessageHandler(handler func(*Session, *Message))
func (*SocketService) Serv ¶
func (s *SocketService) Serv()
func (*SocketService) SetHeartBeat ¶
func (*SocketService) Stop ¶
func (s *SocketService) Stop(reason string)
func (*SocketService) Unicast ¶
func (s *SocketService) Unicast(sid string, msg *Message)
Click to show internal directories.
Click to hide internal directories.