Documentation ¶
Index ¶
- func New(conf coordinator.Config, log *logger.Logger) (services service.Group)
- func NewHTTPServer(conf coordinator.Config, log *logger.Logger, fnMux func(*httpx.Mux) *httpx.Mux) (*httpx.Server, error)
- func RequestToHandshake(data string) (*api.ConnectionRequest[com.Uid], error)
- func StateRoom[T api.Id](id T, rid string) api.StatefulRoom[T]
- type Connection
- type HasServerInfo
- type HasUserRegistry
- type Hub
- type RegionalClient
- type User
- func (u *User) Bind(w *Worker)
- func (u *User) CheckLatency(req api.CheckLatencyUserResponse) (api.CheckLatencyUserRequest, error)
- func (u *User) Disconnect()
- func (u *User) HandleChangePlayer(rq api.ChangePlayerUserRequest)
- func (u *User) HandleLoadGame() error
- func (u *User) HandleQuitGame(rq api.GameQuitRequest[com.Uid])
- func (u *User) HandleRecordGame(rq api.RecordGameRequest[com.Uid])
- func (u *User) HandleRequests(info HasServerInfo, launcher games.Launcher, conf coordinator.Config) chan struct{}
- func (u *User) HandleSaveGame() error
- func (u *User) HandleStartGame(rq api.GameStartUserRequest, launcher games.Launcher, conf coordinator.Config)
- func (u *User) HandleToggleMultitap()
- func (u *User) HandleWebrtcAnswer(rq api.WebrtcAnswerUserRequest)
- func (u *User) HandleWebrtcIceCandidate(rq api.WebrtcUserIceCandidate)
- func (u *User) HandleWebrtcInit()
- func (u *User) InitSession(wid string, ice []webrtc.IceServer, games []string)
- func (u *User) SendWebrtcIceCandidate(candidate string)
- func (u *User) SendWebrtcOffer(sdp string)
- func (u *User) StartGame()
- type Worker
- func (w *Worker) ChangePlayer(id com.Uid, index int) (*api.ChangePlayerResponse, error)
- func (w *Worker) Disconnect()
- func (s *Worker) FreeSlots()
- func (w *Worker) HandleCloseRoom(rq api.CloseRoomRequest)
- func (w *Worker) HandleIceCandidate(rq api.WebrtcIceCandidateRequest[com.Uid], users HasUserRegistry) error
- func (w *Worker) HandleRegisterRoom(rq api.RegisterRoomRequest)
- func (w *Worker) HandleRequests(users HasUserRegistry) chan struct{}
- func (s *Worker) HasSlot() bool
- func (w *Worker) In(region string) bool
- func (w *Worker) LoadGame(id com.Uid) (*api.LoadGameResponse, error)
- func (w *Worker) PrintInfo() string
- func (w *Worker) QuitGame(id com.Uid)
- func (w *Worker) RecordGame(id com.Uid, rec bool, recUser string) (*api.RecordGameResponse, error)
- func (s *Worker) Reserve()
- func (w *Worker) SaveGame(id com.Uid) (*api.SaveGameResponse, error)
- func (w *Worker) StartGame(id com.Uid, app games.AppMeta, req api.GameStartUserRequest) (*api.StartGameResponse, error)
- func (w *Worker) TerminateSession(id com.Uid)
- func (w *Worker) ToggleMultitap(id com.Uid)
- func (s *Worker) UnReserve()
- func (w *Worker) WebrtcAnswer(id com.Uid, sdp string)
- func (w *Worker) WebrtcIceCandidate(id com.Uid, can string)
- func (w *Worker) WebrtcInit(id com.Uid) (*api.WebrtcInitResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHTTPServer ¶
func RequestToHandshake ¶ added in v3.0.5
Types ¶
type Connection ¶ added in v3.0.5
type HasServerInfo ¶ added in v3.0.5
type HasUserRegistry ¶ added in v3.0.5
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
func NewHub ¶
func NewHub(conf coordinator.Config, lib games.GameLibrary, log *logger.Logger) *Hub
func (*Hub) GetServerList ¶
type RegionalClient ¶ added in v3.0.5
type User ¶
type User struct { Connection // contains filtered or unexported fields }
func (*User) CheckLatency ¶
func (u *User) CheckLatency(req api.CheckLatencyUserResponse) (api.CheckLatencyUserRequest, error)
CheckLatency sends a list of server addresses to the user and waits get back this list with tested ping times for each server.
func (*User) Disconnect ¶
func (u *User) Disconnect()
func (*User) HandleChangePlayer ¶
func (u *User) HandleChangePlayer(rq api.ChangePlayerUserRequest)
func (*User) HandleLoadGame ¶
func (*User) HandleQuitGame ¶
func (u *User) HandleQuitGame(rq api.GameQuitRequest[com.Uid])
func (*User) HandleRecordGame ¶
func (u *User) HandleRecordGame(rq api.RecordGameRequest[com.Uid])
func (*User) HandleRequests ¶
func (u *User) HandleRequests(info HasServerInfo, launcher games.Launcher, conf coordinator.Config) chan struct{}
func (*User) HandleSaveGame ¶
func (*User) HandleStartGame ¶
func (u *User) HandleStartGame(rq api.GameStartUserRequest, launcher games.Launcher, conf coordinator.Config)
func (*User) HandleToggleMultitap ¶
func (u *User) HandleToggleMultitap()
func (*User) HandleWebrtcAnswer ¶
func (u *User) HandleWebrtcAnswer(rq api.WebrtcAnswerUserRequest)
func (*User) HandleWebrtcIceCandidate ¶
func (u *User) HandleWebrtcIceCandidate(rq api.WebrtcUserIceCandidate)
func (*User) HandleWebrtcInit ¶
func (u *User) HandleWebrtcInit()
func (*User) InitSession ¶
InitSession signals the user that the app is ready to go.
func (*User) SendWebrtcIceCandidate ¶
SendWebrtcIceCandidate sends remote ICE candidate back to the user.
func (*User) SendWebrtcOffer ¶
SendWebrtcOffer sends SDP offer back to the user.
type Worker ¶
type Worker struct { Connection RegionalClient Addr string PingServer string Port string RoomId string // room reference Tag string Zone string // contains filtered or unexported fields }
func NewWorker ¶ added in v3.0.5
func NewWorker(sock *com.Connection, handshake api.ConnectionRequest[com.Uid], log *logger.Logger) *Worker
func (*Worker) ChangePlayer ¶
func (*Worker) Disconnect ¶
func (w *Worker) Disconnect()
func (*Worker) HandleCloseRoom ¶
func (w *Worker) HandleCloseRoom(rq api.CloseRoomRequest)
func (*Worker) HandleIceCandidate ¶
func (w *Worker) HandleIceCandidate(rq api.WebrtcIceCandidateRequest[com.Uid], users HasUserRegistry) error
func (*Worker) HandleRegisterRoom ¶
func (w *Worker) HandleRegisterRoom(rq api.RegisterRoomRequest)
func (*Worker) HandleRequests ¶
func (w *Worker) HandleRequests(users HasUserRegistry) chan struct{}
func (*Worker) HasSlot ¶
func (s *Worker) HasSlot() bool
HasSlot checks if the current worker has a free slot to start a new game. Workers support only one game at a time, so it returns true in case if there are no players in the room (worker).
func (*Worker) In ¶
In say whether some worker from this region (zone). Empty region always returns true.
func (*Worker) RecordGame ¶
func (*Worker) StartGame ¶
func (w *Worker) StartGame(id com.Uid, app games.AppMeta, req api.GameStartUserRequest) (*api.StartGameResponse, error)
func (*Worker) TerminateSession ¶
func (*Worker) ToggleMultitap ¶
func (*Worker) UnReserve ¶
func (s *Worker) UnReserve()
UnReserve decrements user counter of the worker.
func (*Worker) WebrtcInit ¶
Click to show internal directories.
Click to hide internal directories.