Documentation ¶
Index ¶
- Variables
- type Client
- type EventHandler
- type Option
- func WithClient(client network.Client) 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 WithName(name string) Option
- func WithTimeout(timeout time.Duration) Option
- type Proxy
- type Request
- type RouteHandler
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrClientShut = errors.New("client is shut") ErrConnectionClosed = errors.New("connection closed") )
Functions ¶
This section is empty.
Types ¶
type EventHandler ¶
type EventHandler func(proxy Proxy)
type Proxy ¶
type Proxy interface { // GetID 获取当前节点ID GetID() string // AddRouteHandler 添加路由处理器 AddRouteHandler(route int32, handler RouteHandler) // SetDefaultRouteHandler 设置默认路由处理器,所有未注册的路由均走默认路由处理器 SetDefaultRouteHandler(handler RouteHandler) // AddEventListener 添加事件监听器 AddEventListener(event cluster.Event, handler EventHandler) // Bind 绑定用户ID Bind(uid int64) error // Unbind 解绑用户ID Unbind() error // Push 推送消息 Push(seq, route int32, message interface{}) error // Reconnect 重新连接 Reconnect() error // Disconnect 断开连接 Disconnect() error }
type RouteHandler ¶
type RouteHandler func(req Request)
Click to show internal directories.
Click to hide internal directories.