Documentation
¶
Index ¶
- Variables
- type Master
- type Message
- type Option
- func WithCodec(codec encoding.Codec) Option
- func WithContext(ctx context.Context) Option
- func WithDecryptor(decryptor crypto.Decryptor) Option
- func WithEncryptor(encryptor crypto.Encryptor) 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
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidGID = link.ErrInvalidGID ErrInvalidNID = link.ErrInvalidNID ErrInvalidMessage = link.ErrInvalidMessage ErrInvalidArgument = link.ErrInvalidArgument ErrInvalidSessionKind = link.ErrInvalidSessionKind ErrNotFoundUserSource = link.ErrNotFoundUserSource ErrReceiveTargetEmpty = link.ErrReceiveTargetEmpty )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(o *options)
func WithTransporter ¶
func WithTransporter(transporter transport.Transporter) Option
WithTransporter 设置消息传输器
type Proxy ¶
type Proxy interface {
// GetID 获取当前节点ID
GetID() string
// GetName 获取当前节点名称
GetName() string
// 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, uid int64) (string, error)
// Push 推送消息
Push(ctx context.Context, uid int64, message *Message) error
// Multicast 推送组播消息
Multicast(ctx context.Context, uids []int64, message *Message) (int64, error)
// Broadcast 推送广播消息
Broadcast(ctx context.Context, kind session.Kind, message *Message) (int64, error)
// Deliver 投递消息给节点处理
Deliver(ctx context.Context, uid int64, message *Message) error
// Disconnect 断开连接
Disconnect(ctx context.Context, uid int64, isForce bool) error
}
Click to show internal directories.
Click to hide internal directories.