Documentation ¶
Overview ¶
Package websocket manages websocket connections and notifications for Abot clients. This is used by github.com/itsabot/plugin_training to notify trainers of new user messages without requiring page reload.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AtomicWebSocketSet ¶
type AtomicWebSocketSet struct {
// contains filtered or unexported fields
}
AtomicWebSocketSet maintains open websocket connections with up to one available per user. The uint64 key within the map represents the userID to whom the connection belongs.
func NewAtomicWebSocketSet ¶
func NewAtomicWebSocketSet() AtomicWebSocketSet
NewAtomicWebSocketSet returns an AtomicWebSocketSet to maintain open WebSocket connections on a per-user basis.
func (AtomicWebSocketSet) Get ¶
func (as AtomicWebSocketSet) Get(userID uint64) *websocket.Conn
Get returns a WebSocket connection for a given userID in a thread-safe way.
func (AtomicWebSocketSet) NotifySockets ¶
NotifySockets sends listening clients new messages over WebSockets, eliminating the need for trainers to constantly reload the page.