web

package
v0.0.0-...-107fb91 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PATH_LINK_ACCOUNT    = "/patreon_login"
	PATH_ACCOUNT_LINKING = "/patreon_return"
	PATH_NEW_RAFFLE      = "/new"
	PATH_RAFFLE          = "/r/%s"
	PATH_WEBSOCKET       = "/ws/%s"
	PATH_DASHBOARD       = "/dashboard"
	PATH_ABOUT           = "/about"
	PATH_SCRIPT          = "/raffle.js"
)

Variables

This section is empty.

Functions

func RedirectLinkAccountAndReturn

func RedirectLinkAccountAndReturn(w http.ResponseWriter, req *http.Request)

func RedirectToRaffle

func RedirectToRaffle(w http.ResponseWriter, req *http.Request, raffle *store.Raffle)

func WebSocket

func WebSocket(w http.ResponseWriter, req *http.Request)

Types

type Action

type Action struct {
	J      []byte
	Client *Client
}

type Client

type Client struct {
	Hub *RaffleHub

	Id   int
	Name string

	Conn *websocket.Conn

	Outgoing chan []byte
}

type Lose

type Lose struct {
	Type   string `json:"type"`
	Winner string `json:"winner"`
}

type MasterStatus

type MasterStatus struct {
	Type string `json:"type"`
	Id   int    `json:"id"`
	Name string `json:"name,omitempty"`
}

type RaffleHub

type RaffleHub struct {
	Raffle store.Raffle

	Clients map[int][]*Client
	Masters []*Client

	Register   chan *Client
	Unregister chan *Client

	Actions chan *Action
}

func LookupRaffleHub

func LookupRaffleHub(raffle_id string) *RaffleHub

func (*RaffleHub) Broadcast

func (this *RaffleHub) Broadcast(mode string)

func (*RaffleHub) Cancel

func (this *RaffleHub) Cancel()

func (*RaffleHub) Close

func (this *RaffleHub) Close()

func (*RaffleHub) Disqualify

func (this *RaffleHub) Disqualify(client *Client, to_dq int)

func (*RaffleHub) Draw

func (this *RaffleHub) Draw()

func (*RaffleHub) Enter

func (this *RaffleHub) Enter(client *Client)

func (*RaffleHub) Generic

func (this *RaffleHub) Generic(fn func() (bool, error), mode string)

func (*RaffleHub) Open

func (this *RaffleHub) Open()

func (*RaffleHub) Run

func (this *RaffleHub) Run()

func (*RaffleHub) SendTo

func (this *RaffleHub) SendTo(client *Client, data []byte)

func (*RaffleHub) TargetedBroadcast

func (this *RaffleHub) TargetedBroadcast(to_id int, status, master_status interface{})

func (*RaffleHub) TargetedGeneric

func (this *RaffleHub) TargetedGeneric(client *Client, fn func(int, string) (bool, error), mode string)

func (*RaffleHub) Undisqualify

func (this *RaffleHub) Undisqualify(client *Client, to_undq int)

func (*RaffleHub) Withdraw

func (this *RaffleHub) Withdraw(client *Client)

type Status

type Status struct {
	Type string `json:"type"`
}

Jump to

Keyboard shortcuts

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