Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRoomNotFound = errors.New("wsroom: room not found") ErrParticipantNotFound = errors.New("wsroom: participant not found") ErrParticipantOffline = errors.New("wsroom: participant offline") ErrResolverRejected = errors.New("wsroom: resolver rejected participant") ErrMissingParticipantID = errors.New("wsroom: empty participant id") )
Functions ¶
func NewHandler ¶
Types ¶
type Envelope ¶
type Envelope struct {
Type string `json:"type"`
Payload json.RawMessage `json:"payload"`
}
type Hub ¶
type Hub interface {
HandleWS(w http.ResponseWriter, r *http.Request, room RoomID, identity Identity, resolveParticipant ResolveParticipantFn) error
SendTo(room RoomID, p ParticipantID, msg Envelope) error
Broadcast(room RoomID, msg Envelope, exclude ...ParticipantID) error
CloseRoom(room RoomID) error
}
func NewHub ¶
func NewHub(hooks Hooks, policy ReconnectPolicy) Hub
type JoinContext ¶
type JoinContext struct {
Room RoomID
Participant ParticipantID
Identity Identity
Reconnect bool
}
type ParticipantID ¶
type ParticipantID string
type ReconnectPolicy ¶
type ResolveParticipantFn ¶
Click to show internal directories.
Click to hide internal directories.