Documentation ¶
Index ¶
- Variables
- func DecodeJsonBody(r *http.Request, v interface{}) error
- func DecodeRequestJsonString(content string) (request models.Request, err error)
- func HandlerAddQuestion(w http.ResponseWriter, r *http.Request)
- func HandlerSeedQuestions(w http.ResponseWriter, r *http.Request)
- func Routes(mongoClientId string, database string) *http.ServeMux
- func SerializeMessage(response interface{}) []byte
- func ServeBinquiz(hub *Hub, client *Client)
- func ServeWebsocket(hub *Hub, w http.ResponseWriter, r *http.Request)
- type Client
- type CreatePermissionRequest
- type Enter
- type Hub
- func (hub *Hub) Broadcast(response models.WebsocketMessage, targets map[string]bool)
- func (hub *Hub) Handle(msg models.WebsocketMessage, client *Client) (res models.WebsocketMessage, targets map[string]bool, err error)
- func (hub *Hub) HandleMessages(input []byte, fromClient *Client) (err error)
- func (hub *Hub) OnBegin(request models.Request, client *Client) (res models.WebsocketMessage, targets map[string]bool, err error)
- func (hub *Hub) OnCreate(request models.Request) (res models.WebsocketMessage, targets map[string]bool, err error)
- func (hub *Hub) OnFinish(request models.Request) (res models.WebsocketMessage, targets map[string]bool, err error)
- func (hub *Hub) OnHint(request models.Request) (res models.WebsocketMessage, targets map[string]bool, err error)
- func (hub *Hub) OnJoin(content models.Request) (res models.WebsocketMessage, targets map[string]bool, err error)
- func (hub *Hub) OnNext(request models.Request) (res models.WebsocketMessage, targets map[string]bool, err error)
- func (hub *Hub) OnPass(request models.Request) (res models.WebsocketMessage, targets map[string]bool, err error)
- func (hub *Hub) OnRefresh(request models.Request) (res models.WebsocketMessage, targets map[string]bool, err error)
- func (hub *Hub) OnRight(request models.Request) (res models.WebsocketMessage, targets map[string]bool, err error)
- func (hub *Hub) OnScore(request models.Request) (res models.WebsocketMessage, targets map[string]bool, err error)
- func (hub *Hub) OnStart(request models.Request) (res models.WebsocketMessage, targets map[string]bool, err error)
- func (hub *Hub) OnWatch(content models.Request) (res models.WebsocketMessage, targets map[string]bool, err error)
- func (h *Hub) Run()
- type MatchHandler
- type Message
- type PermissionHandler
Constants ¶
This section is empty.
Variables ¶
var ( FilePath = "G:\\binge\\binge-questions\\%s.json" IndexFile = "index" )
Functions ¶
func DecodeJsonBody ¶
func DecodeRequestJsonString ¶
func HandlerAddQuestion ¶
func HandlerAddQuestion(w http.ResponseWriter, r *http.Request)
func HandlerSeedQuestions ¶
func HandlerSeedQuestions(w http.ResponseWriter, r *http.Request)
func SerializeMessage ¶
func SerializeMessage(response interface{}) []byte
func ServeBinquiz ¶
func ServeWebsocket ¶
func ServeWebsocket(hub *Hub, w http.ResponseWriter, r *http.Request)
serveWs handles websocket requests from the peer.
Types ¶
type Client ¶
type Client struct { Hub *Hub // Buffered channel of outbound messages. Send chan []byte PlayerId string // contains filtered or unexported fields }
Client is a middleman between the websocket connection and the hub.
func (*Client) ReadPump ¶
func (c *Client) ReadPump()
readPump pumps messages from the websocket connection to the hub.
The application runs readPump in a per-connection goroutine. The application ensures that there is at most one reader on a connection by executing all reads from this goroutine.
func (*Client) SetPlayerId ¶
func (*Client) WritePump ¶
func (c *Client) WritePump()
writePump pumps messages from the hub to the websocket connection.
A goroutine running writePump is started for each connection. The application ensures that there is at most one writer to a connection by executing all writes from this goroutine.
type CreatePermissionRequest ¶
type CreatePermissionRequest struct {
PlayerId string `json:"player_id"`
}
type Hub ¶
type Hub struct { // Registered Clients. Clients map[*Client]bool // Register requests from the clients. Register chan *Client // Unregister requests from clients. Unregister chan *Client Controller services.Service // contains filtered or unexported fields }
Hub maintains the set of active clients and broadcasts messages to the clients.
func (*Hub) Broadcast ¶
func (hub *Hub) Broadcast(response models.WebsocketMessage, targets map[string]bool)
func (*Hub) Handle ¶
func (hub *Hub) Handle(msg models.WebsocketMessage, client *Client) (res models.WebsocketMessage, targets map[string]bool, err error)
func (*Hub) HandleMessages ¶
type MatchHandler ¶
type MatchHandler struct {
// contains filtered or unexported fields
}
func (MatchHandler) HandlerActiveQuizzes ¶
func (handler MatchHandler) HandlerActiveQuizzes(w http.ResponseWriter, r *http.Request)
type PermissionHandler ¶
type PermissionHandler struct {
// contains filtered or unexported fields
}
func (PermissionHandler) HandlerCreatePermission ¶
func (handler PermissionHandler) HandlerCreatePermission(w http.ResponseWriter, r *http.Request)
func (PermissionHandler) HandlerFindPermissions ¶
func (handler PermissionHandler) HandlerFindPermissions(w http.ResponseWriter, r *http.Request)