room

package
v2.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SocketAddrTmpl = "/tmp/cloudretro-retro-%s.sock"
)

Variables

This section is empty.

Functions

func NewVideoImporter

func NewVideoImporter(roomID string) chan nanoarch.GameFrame

NewVideoImporter return image Channel from stream

Types

type Room

type Room struct {
	ID string

	// voiceInChannel is voice stream received from users
	//voiceInChannel chan []byte
	// voiceOutChannel is voice stream routed to all users
	//voiceOutChannel chan []byte
	//voiceSample     [][]byte
	// State of room
	IsRunning bool
	// Done channel is to fire exit event when room is closed
	Done chan struct{}
	// contains filtered or unexported fields
}

Room is a game session. multi webRTC sessions can connect to a same game. A room stores all the channel for interaction between all webRTCs session and emulator

func NewRoom

func NewRoom(roomID string, game games.GameMetadata, onlineStorage *storage.Client, cfg worker.Config) *Room

NewRoom creates a new room

func (*Room) AddConnectionToRoom

func (r *Room) AddConnectionToRoom(peerconnection *webrtc.WebRTC)

func (*Room) Close

func (r *Room) Close()

func (*Room) IsEmpty added in v2.5.0

func (r *Room) IsEmpty() bool

func (*Room) IsPCInRoom

func (r *Room) IsPCInRoom(w *webrtc.WebRTC) bool

TODO: Reuse for remove Session

func (*Room) IsRunningSessions

func (r *Room) IsRunningSessions() bool

func (*Room) LoadGame

func (r *Room) LoadGame() error

func (*Room) RemoveSession

func (r *Room) RemoveSession(w *webrtc.WebRTC)

RemoveSession removes a peerconnection from room and return true if there is no more room

func (*Room) SaveGame

func (r *Room) SaveGame() error

SaveGame will save game to local and trigger a callback to store game on onlineStorage, so the game can be accessed later

func (*Room) ToggleMultitap

func (r *Room) ToggleMultitap() error

func (*Room) UpdatePlayerIndex

func (r *Room) UpdatePlayerIndex(peerconnection *webrtc.WebRTC, playerIndex int)

Jump to

Keyboard shortcuts

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