Documentation ¶
Index ¶
Constants ¶
View Source
const Capacity = 10
Variables ¶
This section is empty.
Functions ¶
func UseCollection ¶
func UseCollection(coll *Collection) func(http.Handler) http.Handler
Types ¶
type Client ¶
type Client struct { UserID facechat.ID Events chan interface{} // contains filtered or unexported fields }
func (*Client) Background ¶
func (c *Client) Background() <-chan struct{}
type Collection ¶
func NewCollection ¶
func NewCollection(db *db.DB) *Collection
func RequestCollection ¶
func RequestCollection(r *http.Request) *Collection
func (*Collection) BroadcastMessage ¶
func (c *Collection) BroadcastMessage(msg facechat.Message)
BroadcastMessage broadcasts the given message to room ID topic.
func (*Collection) Register ¶
func (c *Collection) Register(client *Client)
Register registers a client.
func (*Collection) SubscribeRoom ¶
func (c *Collection) SubscribeRoom(userID, roomID facechat.ID)
SubscribeRoom subscribes the user with the ID to a room.
func (*Collection) Unregister ¶
func (c *Collection) Unregister(userID facechat.ID)
Unregister unsubscribes the given client, then removes it from the collection.
func (*Collection) UnsubscribeRoom ¶
func (c *Collection) UnsubscribeRoom(userID, roomID facechat.ID)
UnsubscribeRoom unsubscribes the user with the ID to a room.
Click to show internal directories.
Click to hide internal directories.