Documentation ¶
Index ¶
- Constants
- func NewAgent(conn network.Conn, connector *Connector) *agent
- func NewAgentHandler(a *agent) *agentHandler
- type Agent
- type ChannelRemote
- type Connection
- type Connector
- func (c *Connector) Cb(session *rpc.Session, msgId int, msg interface{})
- func (c *Connector) OnDestroy()
- func (c *Connector) OnInit()
- func (c *Connector) Route(f rpc.CustomerRoute)
- func (c *Connector) Run(closeSig chan bool)
- func (c *Connector) SetConnectionListener(conn Connection)
- func (c *Connector) SetRegisterServiceHandler(r rpc.HandlerRegister)
- func (c *Connector) SetRouter(route rpc.RpcRouter)
- type Option
- func CertFile(f string) Option
- func HTTPTimeout(t time.Duration) Option
- func HeartbeatTimeout(t time.Duration) Option
- func KeyFile(f string) Option
- func LenMsgLen(num int) Option
- func LittleEndian(littleEndian bool) Option
- func MaxConnNum(num int) Option
- func MaxMsgLen(length uint32) Option
- func PendingWriteNum(num int) Option
- func TCPAddr(addr string) Option
- func WSAddr(addr string) Option
- type Options
- type SessionRemote
- func (s *SessionRemote) Bind(ctx context.Context, args *rpc.Args, reply *rpc.Reply) error
- func (s *SessionRemote) GetSessionCount(ctx context.Context, args *rpc.Args, reply *rpc.Reply) error
- func (s *SessionRemote) KickBySid(ctx context.Context, args *rpc.Args, reply *rpc.Reply) error
- func (s *SessionRemote) Push(ctx context.Context, args *rpc.Args, reply *rpc.Reply) error
- func (s *SessionRemote) UnBind(ctx context.Context, args *rpc.Args, reply *rpc.Reply) error
- type TimeJob
- type Timers
Constants ¶
View Source
const ( CODE_OK = 200 CODE_USE_ERROR = 500 CODE_OLD_CLIENT = 501 )
Variables ¶
This section is empty.
Functions ¶
func NewAgentHandler ¶
func NewAgentHandler(a *agent) *agentHandler
Types ¶
type ChannelRemote ¶
type ChannelRemote struct {
// contains filtered or unexported fields
}
func NewChannelRemote ¶
func NewChannelRemote(conn *Connector) *ChannelRemote
func (*ChannelRemote) Broadcast ¶
func (c *ChannelRemote) Broadcast(ctx context.Context, args *rpc.ArgsGroup, reply *rpc.ReplyGroup) error
Broadcast to all the client connectd with current frontend server.
func (*ChannelRemote) PushMessageByGroup ¶
func (c *ChannelRemote) PushMessageByGroup(ctx context.Context, args *rpc.ArgsGroup, reply *rpc.ReplyGroup) error
Push message to client by uids.
type Connection ¶
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
func NewConnector ¶
func (*Connector) Route ¶
func (c *Connector) Route(f rpc.CustomerRoute)
func (*Connector) SetConnectionListener ¶
func (c *Connector) SetConnectionListener(conn Connection)
func (*Connector) SetRegisterServiceHandler ¶
func (c *Connector) SetRegisterServiceHandler(r rpc.HandlerRegister)
Register session service
type Option ¶
type Option func(*Options)
func HTTPTimeout ¶
Timeout for http handshake. Default is 10s
func HeartbeatTimeout ¶
Heartbeat timeout. Default is 10s. Disconnect if after 2*t
func MaxMsgLen ¶
Max message length. If a message exceeds the limit, the connection sends a close message to the peer. Default is 4096
func PendingWriteNum ¶
Length of connection write chan. Default is 200. If pending write too much, it will close connection.
type SessionRemote ¶
type SessionRemote struct {
// contains filtered or unexported fields
}
func NewSessionRemote ¶
func NewSessionRemote(c *Connector) *SessionRemote
func (*SessionRemote) GetSessionCount ¶ added in v1.0.1
Click to show internal directories.
Click to hide internal directories.