Versions in this module Expand all Collapse all v0 v0.25.0 Jun 25, 2026 v0.24.0 Jun 24, 2026 Changes in this version + var ErrClosed = errors.New("realtime: closed") + var ErrUnauthorized = errors.New("realtime: unauthorized") + type AuthRequest struct + Auth []byte + Channel string + ClientID string + Type ChannelType + type AuthResult struct + Allowed bool + Member Member + type Authorizer interface + Authorize func(AuthRequest) AuthResult + type AuthorizerFunc func(AuthRequest) AuthResult + func (f AuthorizerFunc) Authorize(r AuthRequest) AuthResult + type ChannelType int + const Presence + const Private + const Public + func ClassifyChannel(name string) ChannelType + func (t ChannelType) String() string + type Client struct + func (c *Client) Close() error + func (c *Client) Drops() uint64 + func (c *Client) ID() string + func (c *Client) Serve(onMessage func(*Client, MessageType, []byte)) + type Conn interface + Close func() error + ReadMessage func() (MessageType, []byte, error) + WriteMessage func(MessageType, []byte) error + type Hub struct + func NewHub(opts ...HubOption) *Hub + func (h *Hub) Add(conn Conn, auth []byte) (*Client, error) + func (h *Hub) Broadcast(channel string, payload []byte) error + func (h *Hub) BroadcastBinary(channel string, payload []byte) error + func (h *Hub) BroadcastExcept(channel string, payload []byte, exceptID string) error + func (h *Hub) ChannelCount(channel string) int + func (h *Hub) Close() + func (h *Hub) Count() int + func (h *Hub) OnPresence(fn func(PresenceEvent)) + func (h *Hub) Presence(channel string) []Member + func (h *Hub) SendTo(clientID string, payload []byte) error + func (h *Hub) Subscribe(c *Client, channel string) error + func (h *Hub) Unsubscribe(c *Client, name string) + type HubOption func(*Hub) + func WithAuthorizer(a Authorizer) HubOption + func WithLogger(fn func(string, ...any)) HubOption + func WithOutbox(n int) HubOption + func WithSlowConsumerPolicy(p SlowConsumerPolicy) HubOption + type Member struct + ID string + Info []byte + type MessageType int + const BinaryMessage + const TextMessage + type PresenceEvent struct + Channel string + Joined bool + Member Member + type SlowConsumerPolicy int + const DisconnectClient + const DropMessage