Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GateClient ¶
type GateClient interface { // 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) // 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) }
type GateProvider ¶
type GateProvider interface { // Session 获取会话 Session(kind session.Kind, target int64) (*session.Session, error) // Bind 绑定用户与网关间的关系 Bind(ctx context.Context, uid int64) error // Unbind 解绑用户与网关间的关系 Unbind(ctx context.Context, uid int64) error // Push 发送消息(异步) Push(kind session.Kind, target int64, msg []byte, msgType ...int) error // Multicast 推送组播消息(异步) Multicast(kind session.Kind, targets []int64, msg []byte, msgType ...int) (n int, err error) // Broadcast 推送广播消息(异步) Broadcast(kind session.Kind, msg []byte, msgType ...int) (n int, err error) }
type NodeClient ¶
type NodeProvider ¶
type NodeProvider interface { // LocateNode 定位用户所在节点 LocateNode(ctx context.Context, uid int64) (nid string, miss bool, err error) // CheckRouteStateful 检测某个路由是否为有状态路由 CheckRouteStateful(route int32) (stateful bool, exist bool) // Trigger 触发事件 Trigger(event cluster.Event, gid string, uid int64) // Deliver 投递消息 Deliver(gid, nid string, cid, uid int64, message *Message) }
type Transporter ¶
type Transporter interface { // NewGateServer 新建网关服务器 NewGateServer(provider GateProvider) (Server, error) // NewNodeServer 新建节点服务器 NewNodeServer(provider NodeProvider) (Server, error) // NewGateClient 新建网关客户端 NewGateClient(ep *router.Endpoint) (GateClient, error) // NewNodeClient 新建节点客户端 NewNodeClient(ep *router.Endpoint) (NodeClient, error) }
Click to show internal directories.
Click to hide internal directories.