Documentation ¶
Index ¶
- Variables
- type BroadcastArgs
- type BroadcastDeliverArgs
- type DeliverArgs
- type DeliverKind
- type DisconnectArgs
- type GetIPArgs
- type GetIdArgs
- type IsOnlineArgs
- type Link
- func (l *Link) AskGate(ctx context.Context, uid int64, gid string) (string, bool, error)
- func (l *Link) AskNode(ctx context.Context, uid int64, nid string) (string, bool, error)
- func (l *Link) BindGate(ctx context.Context, uid int64, gid string, cid int64) error
- func (l *Link) BindNode(ctx context.Context, uid int64, nid string) error
- func (l *Link) BlockConn(ctx context.Context, onid string, nnid string, target uint64)
- func (l *Link) Broadcast(ctx context.Context, args *BroadcastArgs) (int64, error)
- func (l *Link) BroadcastDeliver(ctx context.Context, args *BroadcastDeliverArgs) error
- func (l *Link) Deliver(ctx context.Context, args *DeliverArgs) error
- func (l *Link) Disconnect(ctx context.Context, args *DisconnectArgs) error
- func (l *Link) FetchServiceAliasIDs(ctx context.Context, kind cluster.Kind, alias string, states ...cluster.State) ([]string, error)
- func (l *Link) FetchServiceAliasList(ctx context.Context, kind cluster.Kind, alias string, states ...cluster.State) ([]*registry.ServiceInstance, error)
- func (l *Link) FetchServiceList(ctx context.Context, kind cluster.Kind, states ...cluster.State) ([]*registry.ServiceInstance, error)
- func (l *Link) GetID(ctx context.Context, args *GetIdArgs) (int64, error)
- func (l *Link) GetIP(ctx context.Context, args *GetIPArgs) (string, error)
- func (l *Link) IsOnline(ctx context.Context, args *IsOnlineArgs) (bool, error)
- func (l *Link) LocateGate(ctx context.Context, uid int64) (string, error)
- func (l *Link) LocateNode(ctx context.Context, uid int64) (string, error)
- func (l *Link) Multicast(ctx context.Context, args *MulticastArgs) (int64, error)
- func (l *Link) MulticastDeliver(ctx context.Context, args *MulticastDeliverArgs) error
- func (l *Link) Ping(ctx context.Context, gid string, message string) (string, error)
- func (l *Link) Push(ctx context.Context, args *PushArgs) error
- func (l *Link) Stat(ctx context.Context, kind session.Kind) (int64, error)
- func (l *Link) StatWithInsId(ctx context.Context, kind session.Kind, insId string) (int64, error)
- func (l *Link) ToBuffer(message interface{}, encrypt bool) ([]byte, error)
- func (l *Link) Trigger(ctx context.Context, args *TriggerArgs) error
- func (l *Link) UnbindGate(ctx context.Context, uid int64) error
- func (l *Link) UnbindNode(ctx context.Context, uid int64, nid string) error
- func (l *Link) WatchServiceInstance(ctx context.Context, kinds ...cluster.Kind)
- func (l *Link) WatchUserLocate(ctx context.Context, kinds ...cluster.Kind)
- type Message
- type MulticastArgs
- type MulticastDeliverArgs
- type Options
- type PushArgs
- type TriggerArgs
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidGID = errors.New("invalid gate id") ErrInvalidNID = errors.New("invalid node id") ErrInvalidMessage = errors.New("invalid message") ErrInvalidSessionKind = errors.New("invalid session kind") ErrNotFoundUserSource = errors.New("not found user source") ErrGateNotFoundUserSource = errors.New("gate not found user source") ErrNodeNotFoundUserSource = errors.New("node not found user source") ErrReceiveTargetEmpty = errors.New("the receive target is empty") ErrInvalidArgument = errors.New("invalid argument") )
Functions ¶
This section is empty.
Types ¶
type BroadcastArgs ¶
type BroadcastDeliverArgs ¶
type BroadcastDeliverArgs struct { Kind DeliverKind Message interface{} // 消息 }
type DeliverArgs ¶
type DisconnectArgs ¶
type IsOnlineArgs ¶
type Link ¶
type Link struct {
// contains filtered or unexported fields
}
func (*Link) BindNode ¶
BindNode 绑定节点 单个用户只能被绑定到某一台节点服务器上,多次绑定会直接覆盖上次绑定 绑定操作会通过发布订阅方式同步到网关服务器和其他相关节点服务器上 nid 为需要绑定的节点ID
func (*Link) BroadcastDeliver ¶
func (l *Link) BroadcastDeliver(ctx context.Context, args *BroadcastDeliverArgs) error
func (*Link) Deliver ¶
func (l *Link) Deliver(ctx context.Context, args *DeliverArgs) error
Deliver 投递消息给节点处理
func (*Link) Disconnect ¶
func (l *Link) Disconnect(ctx context.Context, args *DisconnectArgs) error
Disconnect 断开连接
func (*Link) FetchServiceAliasIDs ¶
func (*Link) FetchServiceAliasList ¶
func (*Link) FetchServiceList ¶
func (l *Link) FetchServiceList(ctx context.Context, kind cluster.Kind, states ...cluster.State) ([]*registry.ServiceInstance, error)
FetchServiceList 拉取服务列表
func (*Link) LocateGate ¶
LocateGate 定位用户所在网关
func (*Link) LocateNode ¶
LocateNode 定位用户所在节点
func (*Link) MulticastDeliver ¶
func (l *Link) MulticastDeliver(ctx context.Context, args *MulticastDeliverArgs) error
func (*Link) StatWithInsId ¶ added in v0.0.56
StatWithInsId 统计会话总数
func (*Link) Trigger ¶
func (l *Link) Trigger(ctx context.Context, args *TriggerArgs) error
Trigger 触发事件
func (*Link) UnbindGate ¶
UnbindGate 解绑网关
func (*Link) UnbindNode ¶
UnbindNode 解绑节点 解绑时会对解绑节点ID进行校验,不匹配则解绑失败 解绑操作会通过发布订阅方式同步到网关服务器和其他相关节点服务器上 nid 为需要解绑的节点ID
func (*Link) WatchServiceInstance ¶
WatchServiceInstance 监听服务实例
type MulticastArgs ¶
type MulticastDeliverArgs ¶
type MulticastDeliverArgs struct { Kind DeliverKind Targets []string Message interface{} // 消息 }
type Options ¶
type Options struct { GID string // 网关ID NID string // 节点ID Codec encoding.Codec // 编解码器 Locator locate.Locator // 定位器 Registry registry.Registry // 注册器 Encryptor crypto.Encryptor // 加密器 Transporter transport.Transporter // 传输器 BalanceStrategy dispatcher.BalanceStrategy // 负载均衡策略 Namespace string }
Click to show internal directories.
Click to hide internal directories.