Documentation
¶
Index ¶
- Variables
- type BroadcastArgs
- type DeliverArgs
- type DisconnectArgs
- type EventHandler
- type GetIPArgs
- type Message
- type MulticastArgs
- type Node
- type Option
- func WithCodec(codec encoding.Codec) Option
- func WithContext(ctx context.Context) Option
- func WithID(id string) Option
- func WithLocator(locator locate.Locator) Option
- func WithName(name string) Option
- func WithRegistry(r registry.Registry) Option
- func WithTimeout(timeout time.Duration) Option
- func WithTransporter(transporter transport.Transporter) 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 DisconnectArgs ¶ added in v0.0.3
type EventHandler ¶
type MulticastArgs ¶
type Option ¶
type Option func(o *options)
func WithLocator ¶ added in v0.0.3
WithLocator 设置定位器
func WithTransporter ¶ added in v0.0.4
func WithTransporter(transporter transport.Transporter) Option
WithTransporter 设置消息传输器
type Proxy ¶
type Proxy interface { // AddRouteHandler 添加路由处理器 AddRouteHandler(route int32, stateful bool, handler RouteHandler) // SetDefaultRouteHandler 设置默认路由处理器,所有未注册的路由均走默认路由处理器 SetDefaultRouteHandler(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, nid ...string) error // UnbindNode 解绑节点 UnbindNode(ctx context.Context, uid int64, nid ...string) error // LocateGate 定位用户所在网关 LocateGate(ctx context.Context, uid int64) (string, error) // LocateNode 定位用户所在节点 LocateNode(ctx context.Context, uid int64) (string, error) // FetchGateList 拉取网关列表 FetchGateList(ctx context.Context, states ...cluster.State) ([]*registry.ServiceInstance, error) // FetchNodeList 拉取节点列表 FetchNodeList(ctx context.Context, states ...cluster.State) ([]*registry.ServiceInstance, 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) // Disconnect 断开连接 Disconnect(ctx context.Context, args *DisconnectArgs) error }
type Request ¶
type Request interface { // GID 获取来源网关ID GID() string // NID 获取来源节点ID NID() string // CID 获取来源连接ID CID() int64 // UID 获取来源用户ID UID() int64 // Seq 获取消息序列号 Seq() int32 // Route 获取路由 Route() int32 // Data 获取数据 Data() interface{} // Parse 解析请求 Parse(v interface{}) error // Context 获取上线文 Context() context.Context // Response 响应请求 Response(message interface{}) error // BindGate 绑定网关 BindGate(uid int64) error // UnbindGate 解绑网关 UnbindGate() error // BindNode 绑定节点 BindNode() error // UnbindNode 解绑节点 UnbindNode() error }
type RouteHandler ¶
type RouteHandler func(req Request)
Click to show internal directories.
Click to hide internal directories.