Ejemplo n.º 1
0
// Sanitizes given response and sends it to every player's session in the pool.
func (cp *ClientPool) Send(player *entities.Player, response response.Responser) {
	defer func() {
		if panicked := recover(); panicked != nil {
			return
		}
	}()
	response.Sanitize(player)

	for element := cp.pool[player.Username].Front(); element != nil; element = element.Next() {
		client := element.Value.(*Client)
		client.Send(response)
	}
}
Ejemplo n.º 2
0
// Send response directly to the client
func (c *Client) Send(response response.Responser) {
	response.Sanitize(c.Player)
	c.codec.Send(c.Conn, &response)
}