Documentation
¶
Index ¶
- Variables
- func FormatMSG(event string, data ...string) []byte
- func Run(ch chan Message, w http.ResponseWriter, r *http.Request) error
- type Message
- type Pool
- func (h *Pool) Add(userID string) chan Message
- func (h *Pool) Connections() int
- func (h *Pool) GetAllConnectedUsers() set.GenericDataSet[string]
- func (h *Pool) Handler(w http.ResponseWriter, r *http.Request)
- func (h *Pool) Remove(userID string)
- func (h *Pool) Send(userID string, msg Message) error
- func (h *Pool) SendToAll(msg Message)
- func (h *Pool) StopAll()
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidUserID = errors.New("invalid user id") ErrNotFoundConnectedUser = errors.New("not found connected user") ErrResponseWriterIsNotFlusher = errors.New("response does not support flush") )
All kind of errors
View Source
var (
ContextUserID utils.ContextKey = "userID"
)
Describe all context keys
Functions ¶
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool contains all connections and could delivery messages
func (*Pool) GetAllConnectedUsers ¶
func (h *Pool) GetAllConnectedUsers() set.GenericDataSet[string]
GetAllConnectedUsers get all connected users
func (*Pool) Handler ¶
func (h *Pool) Handler(w http.ResponseWriter, r *http.Request)
Handler listen for messages
Click to show internal directories.
Click to hide internal directories.