Documentation ¶
Index ¶
Constants ¶
View Source
const ( Bind = 1 Unbind = 2 Push = 3 Multicast = 4 Broadcast = 5 Trigger = 6 Deliver = 7 Disconnect = 8 GetID = 9 GetIP = 10 Stat = 11 IsOnline = 12 BlockConn = 13 ReleaseConn = 14 Ping = 15 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchPushArg ¶ added in v0.0.23
type BatchPushArg struct {
// contains filtered or unexported fields
}
type BatchPushArgs ¶ added in v0.0.23
type BatchPushArgs struct {
BatchPushArgs []*BatchPushArg
}
type DeliverArgs ¶
type DisconnectHandler ¶ added in v0.0.23
type DisconnectHandler func(target string)
type GateClient ¶
type GateClient interface { // Ping ping测试消息 Ping(ctx context.Context, message string) (reply string, err error) // Bind 绑定用户与连接 Bind(ctx context.Context, cid, uid int64) (miss bool, err error) // Unbind 解绑用户与连接 Unbind(ctx context.Context, uid int64) (miss bool, err error) // GetIP 获取客户端IP GetIP(ctx context.Context, kind session.Kind, target int64) (ip string, miss bool, err error) // Disconnect 断开连接 Disconnect(ctx context.Context, kind session.Kind, target int64, isForce bool) (miss bool, err error) // Stat 统计会话总数 Stat(ctx context.Context, kind session.Kind) (total int64, miss bool, err error) // IsOnline 检测是否在线 IsOnline(ctx context.Context, kind session.Kind, target int64) (isOnline, miss bool, err error) // GetID 检测是否在线 GetID(ctx context.Context, kind session.Kind, target int64) (id int64, err error) // Push 推送消息 Push(ctx context.Context, kind session.Kind, target int64, message *Message) (miss bool, err error) // Multicast 推送组播消息 Multicast(ctx context.Context, kind session.Kind, targets []int64, message *Message) (total int64, err error) // Broadcast 推送广播消息 Broadcast(ctx context.Context, kind session.Kind, message *Message) (total int64, err error) BlockConn(ctx context.Context, onid string, nnid string, targets uint64) (err error) }
type GateProvider ¶
type GateProvider 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) // GetID 获取conn的id GetID(ctx context.Context, kind session.Kind, target int64) (id int64, err error) // Push 发送消息(异步) Push(ctx context.Context, kind session.Kind, target int64, message *packet.Message) error // Multicast 推送组播消息(异步) Multicast(ctx context.Context, kind session.Kind, targets []int64, message *packet.Message) (total int64, err error) // Broadcast 推送广播消息(异步) Broadcast(ctx context.Context, kind session.Kind, message *packet.Message) (total int64, err error) // Disconnect 断开连接 Disconnect(ctx context.Context, kind session.Kind, target int64, isForce bool) error // Stat 统计会话总数 Stat(ctx context.Context, kind session.Kind) (total int64, err error) // Block Block(ctx context.Context, oNid string, nNid string, targets uint64) // Release Release(ctx context.Context, targets uint64) }
type NodeClient ¶
type NodeClient interface { // Trigger 触发事件 Trigger(ctx context.Context, args *TriggerArgs) (miss bool, err error) // Deliver 投递消息 Deliver(ctx context.Context, args *DeliverArgs) (miss bool, err error) }
type NodeProvider ¶
type NodeProvider interface { // Trigger 触发事件 Trigger(ctx context.Context, args *TriggerArgs) (miss bool, err error) // Deliver 投递消息 Deliver(ctx context.Context, args *DeliverArgs) (miss bool, err error) }
type ReceiveHandler ¶ added in v0.0.23
type Transporter ¶
type Transporter interface { // SetDefaultDiscovery 设置默认的服务发现组件 SetDefaultDiscovery(discovery registry.Discovery) // NewGateServer 新建网关服务器 NewGateServer(provider GateProvider) (Server, error) // NewNodeServer 新建节点服务器 NewNodeServer(provider NodeProvider) (Server, error) // NewGateClient 新建网关客户端 NewGateClient(ep *endpoint.Endpoint) (GateClient, error) // NewNodeClient 新建节点客户端 NewNodeClient(ep *endpoint.Endpoint) (NodeClient, error) // UpdateClientPool 更新客户端 UpdateClientPool(endpoints map[string]*endpoint.Endpoint) }
Click to show internal directories.
Click to hide internal directories.