Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller manages all streams
func NewController ¶
func NewController() *Controller
NewController returns a controller that mediates new stream connections to a specific GameKey and broadcasts game state across all registered streams for a given GameKey.
func (*Controller) Broadcast ¶
func (sc *Controller) Broadcast(key keys.GameKey, g game.GameState)
Broadcast sends the game state across all connected streams for the given GameKey.
func (*Controller) CreateStream ¶
func (sc *Controller) CreateStream(key keys.GameKey) *Stream
CreateStream will take a proto stream, transform it into a game stream, and register is with the controller. This allows the render loop to send a game's state to all registered streams for the given game's keys.GameKey.
func (*Controller) RemoveStream ¶
func (sc *Controller) RemoveStream(key keys.GameKey, stream *Stream)
RemoveStream stops and deregisters the given stream on the given keys.GameKey so that renders no longer propagate to the stream.
func (*Controller) Stop ¶
func (sc *Controller) Stop()
Stop ends all streams and closes the controller