Versions in this module Expand all Collapse all v1 v1.0.0 Mar 4, 2026 Changes in this version + var ErrMissingParticipantID = errors.New("wsroom: empty participant id") + var ErrParticipantNotFound = errors.New("wsroom: participant not found") + var ErrParticipantOffline = errors.New("wsroom: participant offline") + var ErrResolverRejected = errors.New("wsroom: resolver rejected participant") + var ErrRoomNotFound = errors.New("wsroom: room not found") + func NewHandler(hub Hub, room RoomID, identity Identity, ...) http.Handler + type Client interface + Close func(code websocket.StatusCode, reason string) error + Send func(ctx context.Context, msg Envelope) error + type Envelope struct + Payload json.RawMessage + Type string + type Handler struct + func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Hooks interface + OnJoin func(ctx context.Context, jc JoinContext, client Client) error + OnLeave func(ctx context.Context, room RoomID, p ParticipantID, reason error) + OnMessage func(ctx context.Context, room RoomID, p ParticipantID, msg Envelope) error + type Hub interface + Broadcast func(room RoomID, msg Envelope, exclude ...ParticipantID) error + CloseRoom func(room RoomID) error + HandleWS func(w http.ResponseWriter, r *http.Request, room RoomID, identity Identity, ...) error + SendTo func(room RoomID, p ParticipantID, msg Envelope) error + func NewHub(hooks Hooks, policy ReconnectPolicy) Hub + type Identity struct + SessionID string + UserID string + type JoinContext struct + Identity Identity + Participant ParticipantID + Reconnect bool + Room RoomID + type ParticipantID string + type ReconnectPolicy struct + GracePeriod time.Duration + MaxQueuedPerConn int + type ResolveParticipantFn func(ctx context.Context, room RoomID, identity Identity) (ParticipantID, error) + type RoomID string