Documentation
¶
Index ¶
- Variables
- type BroadcastArgs
- type DeliverArgs
- type EventHandler
- type GetIPArgs
- type MulticastArgs
- type Node
- type Option
- func WithCodec(codec encoding.Codec) Option
- func WithContext(ctx context.Context) Option
- func WithGRPCServer(grpc *grpc.Server) Option
- func WithID(id string) Option
- func WithName(name string) Option
- func WithRedis(redis redis.Client) Option
- func WithRegistry(r registry.Registry) Option
- func WithTimeout(timeout time.Duration) Option
- type Proxy
- type PushArgs
- type Request
- type RouteHandler
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BroadcastArgs ¶
type DeliverArgs ¶
type EventHandler ¶
type MulticastArgs ¶
type Proxy ¶
type Proxy interface { // AddRoute 添加路由 AddRoute(route int32, stateful bool, handler RouteHandler) // AddEventListener 添加事件监听器 AddEventListener(event cluster.Event, handler EventHandler) // BindGate 绑定网关 BindGate(ctx context.Context, gid string, cid, uid int64) error // UnbindGate 绑定网关 UnbindGate(ctx context.Context, uid int64) error // BindNode 绑定节点 BindNode(ctx context.Context, uid int64) error // UnbindNode 解绑节点 UnbindNode(ctx context.Context, uid int64) error // LocateGate 定位用户所在网关 LocateGate(ctx context.Context, uid int64) (string, error) // LocateNode 定位用户所在节点 LocateNode(ctx context.Context, uid int64) (string, error) // GetIP 获取客户端IP GetIP(ctx context.Context, args *GetIPArgs) (string, error) // Push 推送消息 Push(ctx context.Context, args *PushArgs) error // Response 响应消息 Response(ctx context.Context, req Request, message interface{}) error // Multicast 推送组播消息 Multicast(ctx context.Context, args *MulticastArgs) (int64, error) // Broadcast 推送广播消息 Broadcast(ctx context.Context, args *BroadcastArgs) (int64, error) }
type Request ¶
type Request interface { // GID 获取来源网关ID GID() string // NID 获取来源节点ID NID() string // CID 获取来源连接ID CID() int64 // UID 获取来源用户ID UID() int64 // Route 获取路由 Route() int32 // Parse 解析请求 Parse(v interface{}) error // Context 获取上线文 Context() context.Context // Response 响应请求 Response(message interface{}) error }
type RouteHandler ¶
type RouteHandler func(req Request)
Click to show internal directories.
Click to hide internal directories.