Documentation
¶
Index ¶
- type Builder
- type Client
- func (c *Client) Bind(ctx context.Context, cid, uid int64) (bool, error)
- func (c *Client) Broadcast(ctx context.Context, kind session.Kind, message buffer.Buffer) error
- func (c *Client) Disconnect(ctx context.Context, kind session.Kind, target int64, force bool) error
- func (c *Client) GetIP(ctx context.Context, kind session.Kind, target int64) (string, bool, error)
- func (c *Client) GetState(ctx context.Context) (cluster.State, error)
- func (c *Client) IsOnline(ctx context.Context, kind session.Kind, target int64) (bool, bool, error)
- func (c *Client) Multicast(ctx context.Context, kind session.Kind, targets []int64, message buffer.Buffer) error
- func (c *Client) Push(ctx context.Context, kind session.Kind, target int64, message buffer.Buffer) error
- func (c *Client) SetState(ctx context.Context, state cluster.State) error
- func (c *Client) Stat(ctx context.Context, kind session.Kind) (int64, error)
- func (c *Client) Unbind(ctx context.Context, uid int64) (bool, error)
- type Options
- type Provider
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Disconnect ¶
Disconnect 断开连接
func (*Client) Multicast ¶
func (c *Client) Multicast(ctx context.Context, kind session.Kind, targets []int64, message buffer.Buffer) error
Multicast 推送组播消息
func (*Client) Push ¶
func (c *Client) Push(ctx context.Context, kind session.Kind, target int64, message buffer.Buffer) error
Push 异步推送消息
type Provider ¶
type Provider interface {
// Bind 绑定用户与网关间的关系
Bind(ctx context.Context, cid, uid int64) error
// Unbind 解绑用户与网关间的关系
Unbind(ctx context.Context, uid int64) error
// GetIP 获取客户端IP地址
GetIP(ctx context.Context, kind session.Kind, target int64) (ip string, err error)
// IsOnline 检测是否在线
IsOnline(ctx context.Context, kind session.Kind, target int64) (isOnline bool, err error)
// Stat 统计会话总数
Stat(ctx context.Context, kind session.Kind) (total int64, err error)
// Disconnect 断开连接
Disconnect(ctx context.Context, kind session.Kind, target int64, force bool) error
// Push 发送消息
Push(ctx context.Context, kind session.Kind, target int64, message []byte) error
// Multicast 推送组播消息
Multicast(ctx context.Context, kind session.Kind, targets []int64, message []byte) (total int64, err error)
// Broadcast 推送广播消息
Broadcast(ctx context.Context, kind session.Kind, message []byte) (total int64, err error)
// GetState 获取状态
GetState() (cluster.State, error)
// SetState 设置状态
SetState(state cluster.State) error
}
Click to show internal directories.
Click to hide internal directories.