Documentation
¶
Overview ¶
Package realtime 提供共享身份入口和基于 Redis Stream 的跨实例恢复.
Index ¶
- Variables
- type Handler
- type Hub
- func (h *Hub) Close()
- func (h *Hub) Drain(ctx context.Context)
- func (h *Hub) Handle(name string, handler Handler) error
- func (h *Hub) Presence(ctx context.Context, p Principal) (int64, error)
- func (h *Hub) Publish(ctx context.Context, to Principal, event string, data any) (string, error)
- func (h *Hub) PublishChannel(ctx context.Context, channel, event string, data any) (string, error)
- func (h *Hub) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *Hub) Ticket(ctx context.Context, p Principal, resume, locale string) (string, error)
- type Message
- type Principal
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrResumeInvalid = errors.New("恢复会话无效,请重新建立连接")
ErrResumeInvalid表示实时恢复凭证失效,不代表账号登录失效。
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct {
Redis redis.UniversalClient
Prefix string
Path string
Origins []string
Validate func(context.Context, Principal) error
Authorize func(context.Context, Principal, string) error
// AuthorizeEvent checks permissions again before an inbox or channel event is delivered.
AuthorizeEvent func(context.Context, Principal, Message) error
// Connected runs after authentication; Disconnected runs when that connection exits.
Connected func(context.Context, Principal) error
Disconnected func(context.Context, Principal)
Retention time.Duration
Limit int64
// contains filtered or unexported fields
}
func (*Hub) PublishChannel ¶
Click to show internal directories.
Click to hide internal directories.