app

package
v0.0.0-...-afdb705 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPlayerToLobby

func AddPlayerToLobby(player *models.Player, lobbyID string) error

Adds player to lobby with provided player id and lobby id

func Auth

func Auth(c *fiber.Ctx) error

func CreateLobby

func CreateLobby() int

Creates lobby and returns lobby id using bogo lobby algorithm

func CreatePlayer

func CreatePlayer(c *websocket.Conn, uuid string) *models.Player

func GenerateCarousel

func GenerateCarousel(c *spotify.Client) []string

func HandleAddPlayerRequest

func HandleAddPlayerRequest(c *websocket.Conn)

Reads player id and lobby id and assigns player to lobby if both player id and lobby exist

func HandleCreationRequest

func HandleCreationRequest(c *websocket.Conn)

Handle websocket request for lobby creation

func JoinLobby

func JoinLobby(c *websocket.Conn, lobby string)

func PlayerWorker

func PlayerWorker(c *websocket.Conn, p *models.Player, l *models.Lobby)

Types

type App

type App struct {
	Config Config
	Store  *database.Store
	Fiber  *fiber.App
}

func New

func New(args ...Config) App

func (*App) Run

func (a *App) Run()

func (*App) Shutdown

func (a *App) Shutdown()

type ClientData

type ClientData struct {
	Optype string `json:"command"` // Contains type of operation - GAME START, GUESS ANSWER ETC
	Data   any    `json:"body"`    // Contains data relating to option above
}

type Config

type Config struct {
	Port string
	Log  bool
}

type GuessData

type GuessData struct {
	AnswerId string `json:"answerId"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL