communication

package
v0.0.0-...-5062497 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2018 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DIRECTORY = "log"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client struct holds client-specific variables.

func NewClient

func NewClient(ws *websocket.Conn, server *Server) *Client

NewClient initializes a new Client struct with given websocket.

func (*Client) Conn

func (c *Client) Conn() *websocket.Conn

Conn returns client's websocket.Conn struct.

func (*Client) Done

func (c *Client) Done()

Done sends done message to the Client which closes the conection.

func (*Client) Listen

func (c *Client) Listen()

Listen Write and Read request via chanel

func (*Client) SendMessage

func (c *Client) SendMessage(bytes *[]byte)

SendMessage sends game state to the client.

type FileWriter

type FileWriter struct {
	// contains filtered or unexported fields
}

func NewFileWriter

func NewFileWriter(space *state.Space) (*FileWriter, error)

func (*FileWriter) HandlePhysicsReady

func (fileWriter *FileWriter) HandlePhysicsReady(physicsReadyEvent *events.PhysicsReady)

func (*FileWriter) HandleTimeTick

func (fileWriter *FileWriter) HandleTimeTick(timeTickEvent *events.TimeTick)

func (*FileWriter) Run

func (fileWriter *FileWriter) Run()

type ScoreBoardSender

type ScoreBoardSender struct {
	// contains filtered or unexported fields
}

func NewScoreBoardSender

func NewScoreBoardSender(server *Server, scoreBoardReader *persistence.ScoreBoardReader,
	userNameRegistry *utils.UserNamesRegistry) *ScoreBoardSender

func (*ScoreBoardSender) HandleScoreSent

func (sender *ScoreBoardSender) HandleScoreSent(scoreSent *events.ScoreSent)

func (*ScoreBoardSender) HandleUserJoined

func (sender *ScoreBoardSender) HandleUserJoined(userJoinedEvent *events.UserJoined)

type Sender

type Sender struct {
	// contains filtered or unexported fields
}

func NewSender

func NewSender(server *Server, space *state.Space, userNameRegistry *utils.UserNamesRegistry) *Sender

func (*Sender) HandleObjectDestroyed

func (sender *Sender) HandleObjectDestroyed(userDiedEvent *events.ObjectDestroyed)

func (*Sender) HandlePhysicsReady

func (sender *Sender) HandlePhysicsReady(physicsReadyEvent *events.PhysicsReady)

func (*Sender) HandleProjectileFired

func (sender *Sender) HandleProjectileFired(projectileFiredEvent *events.ProjectileFired)

func (*Sender) HandleProjectileHit

func (sender *Sender) HandleProjectileHit(projectileHitEvent *events.ProjectileHit)

func (*Sender) HandleUserConnected

func (sender *Sender) HandleUserConnected(userConnectedEvent *events.UserConnected)

func (*Sender) HandleUserJoined

func (sender *Sender) HandleUserJoined(userJoinedEvent *events.UserJoined)

func (*Sender) HandleUserLeft

func (sender *Sender) HandleUserLeft(userLeftEvent *events.UserLeft)

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server struct holds server variables.

func NewServer

func NewServer(pattern string, monitor *monitor.Monitor, eventDispatcher *events.EventDispatcher,
	idManager *utils.IdManager, userNameRegistry *utils.UserNamesRegistry) *Server

NewServer initializes a new server.

func (*Server) ClientIDs

func (s *Server) ClientIDs() []uint32

func (*Server) GetClient

func (s *Server) GetClient(clientId uint32) (*Client, bool)

func (*Server) HandleUserLeft

func (s *Server) HandleUserLeft(userLeftEvent *events.UserLeft)

func (*Server) Listen

func (s *Server) Listen()

Listen runs puts server into listening mode.

func (*Server) SendToAllClients

func (s *Server) SendToAllClients(message proto.Message)

func (*Server) SendToClient

func (s *Server) SendToClient(clientID uint32, message proto.Message)

Jump to

Keyboard shortcuts

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