Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServeWs ¶
func ServeWs(server *Server, clientConfig *ClientConfig, logger *log.Entry) http.HandlerFunc
ServeWs registers a WS client
Types ¶
type ClientConfig ¶
type ClientConfig struct { WriteWait time.Duration PongWait time.Duration PingPeriod time.Duration MaxMessageSize int64 }
ClientConfig contains configuration needed to communicate with the WS server
type MessagePayload ¶
MessagePayload is the envelope for messages sent to and from the chat participants
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is our hub for all WS clients
func (*Server) ClientCount ¶
ClientCount returns the number of connected clients
func (*Server) ConsumeRMQ ¶
func (server *Server) ConsumeRMQ()
ConsumeRMQ reads the RabbitMQ response queue and broadcasts it to clients
type WSClient ¶
type WSClient struct {
// contains filtered or unexported fields
}
WSClient is the websocket client users will connect to
func NewWSClient ¶
func NewWSClient(conn *websocket.Conn, server *Server, config *ClientConfig, logger *log.Entry, room string) *WSClient
NewWSClient instantiates a new websocket client
func (*WSClient) ExtractCommandAndArgs ¶
ExtractCommandAndArgs parses a bot command and any arguments it may have
func (*WSClient) IsValidBotCommand ¶
IsValidBotCommand verifies if a message should be treated as a bot command
Click to show internal directories.
Click to hide internal directories.