Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoardHandler ¶
func (*BoardHandler) HandleBoard ¶
func (h *BoardHandler) HandleBoard(c echo.Context) error
type EventsHandler ¶
type EventsHandler struct { Games *map[string]*model.Board BroadcastChannel model.BroadcastChannel Clients map[string][]chan *model.Cell // Maps game IDs to client channels }
func NewEventsHandler ¶
func NewEventsHandler(games *map[string]*model.Board, bc model.BroadcastChannel, clients map[string][]chan *model.Cell) *EventsHandler
func (*EventsHandler) HandleEvents ¶
func (h *EventsHandler) HandleEvents(c echo.Context) error
HandleEvents sets up an SSE connection and listens for updates to send to the client.
func (*EventsHandler) ListenToBroadcasts ¶
func (h *EventsHandler) ListenToBroadcasts()
ListenToBroadcasts starts listening to the broadcast channel and forwards events to relevant clients.
type HomeHandler ¶
type HomeHandler struct{}
By keeping an independent handler for each route, we can easily have separetion of concerns and also keep the codebase maintainable and readable. This is also good for testing as we can easily test each handler independently.
func (*HomeHandler) HandleHome ¶
func (h *HomeHandler) HandleHome(c echo.Context) error
type NewGameHandler ¶
func (*NewGameHandler) HandleNewGame ¶
func (h *NewGameHandler) HandleNewGame(c echo.Context) error
type PlayHandler ¶
type PlayHandler struct { Games *map[string]*model.Board BroadcastChannel model.BroadcastChannel }
func (*PlayHandler) HandlePlay ¶
func (h *PlayHandler) HandlePlay(c echo.Context) error
Click to show internal directories.
Click to hide internal directories.