Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatMessage ¶
type Client ¶
type Client struct { Conn *websocket.Conn Answers chan *Answer Question chan *Question Notifications chan *Notification Messages chan *ChatMessage ID int `json:"id"` RoomID int `json:"room_id"` UserID int `json:"user_id"` Username string `json:"username"` }
func (*Client) ReadAnswer ¶
func (*Client) ReadChatMessage ¶
func (*Client) WriteChatMessage ¶
func (c *Client) WriteChatMessage()
func (*Client) WriteNotification ¶
func (*Client) WriteQuestion ¶
type ClientResponse ¶
type CreateRoomRequest ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) CreateRoom ¶
func (*Handler) ListClients ¶
type Hub ¶
type Hub struct { Rooms map[int]*Room Register chan *Client Unregister chan *Client Notify chan *Notification Messages chan *ChatMessage Answers chan *Answer }
type Notification ¶
type Question ¶
type Question struct { ID int `json:"id"` Text string `json:"text"` Answers []string `json:"answers"` Subject string `json:"subject"` CorrectAnswer int8 `json:"correct_answer"` }
func (*Question) GetRandomQuestion ¶
type Room ¶
type Room struct { ID int `json:"id"` Name string `json:"name"` Answers chan *Answer `json:"answers"` Question *Question `json:"question"` NumberOfQuestions int `json:"number_of_questions"` Timeout time.Duration `json:"timeout"` Subject string `json:"subject"` Clients map[int]*Client `json:"clients"` Players int `json:"players"` Capacity int `json:"capacity"` }
type RoomResponse ¶
Click to show internal directories.
Click to hide internal directories.