Documentation
¶
Index ¶
- func ErrorToHttpCode(err error) int
- func SendJsonResponse(writer http.ResponseWriter, resp interface{}, err error)
- func WSConnWriteError(wsConn *websocket.Conn, err error) error
- func WSConnWriteMessage(wsConn *websocket.Conn, msg interface{}) error
- type WSClient
- type WSFanOut
- type WSMsgType
- type WSMux
- func (w *WSMux) AddToTopic(topicId string, client *WSClient) error
- func (w *WSMux) Publish(topicId string, msg WSMsgType) error
- func (w *WSMux) RemoveClient(client *WSClient) error
- func (w *WSMux) RemoveFromTopic(topicId string, client *WSClient) error
- func (w *WSMux) SetForTopic(topicId string, client *WSClient) error
- func (w *WSMux) Subscribe(req *http.Request, writer http.ResponseWriter) (*WSClient, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorToHttpCode ¶
func SendJsonResponse ¶
func SendJsonResponse(writer http.ResponseWriter, resp interface{}, err error)
func WSConnWriteMessage ¶
Types ¶
type WSClient ¶
type WSMux ¶
type WSMux struct { Upgrader websocket.Upgrader HandleClientMessage func(ws *WSMux, msg WSMsgType) error // contains filtered or unexported fields }
func (*WSMux) AddToTopic ¶
Adds a client to a particular topic id. This makes it eligible to receive messages sent on a particular topic Normally this is called by
func (*WSMux) RemoveClient ¶
func (*WSMux) RemoveFromTopic ¶
Remove a client from particular topic id. This makes it stop receiving messages sent on the particular topic
func (*WSMux) SetForTopic ¶
Sets the "listening" client on a topic. This ensures that there is only a single client for the given topic.
Click to show internal directories.
Click to hide internal directories.