func (s *Socket) Send(m message.Message) {
	if !s.isOpen() {
		s.log.Error("websocket not open")
		return
	}
	if m.Game == nil {
		var g game.Info
		m.Game = &g
	}
	if m.Type != message.CreateGame { // all messages except CREATE are for a specific game
		m.Game.ID = s.game.ID()
	}
	messageJSON, err := json.Marshal(m)
	if err != nil {
		s.log.Error("marshalling socket message to send: " + err.Error())
		return
	}
	s.webSocket.Call("send", string(messageJSON))
}
// Send delivers a message to the server via it's websocket.
Send delivers a message to the server via it's websocket.
// Send delivers a message to the server via it ' s websocket .
func (s *Socket) Send(m message.Message) {
	if !s.isOpen() {
		s.log.Error("websocket not open")
		return
	}
	if m.Game == nil {
		var g game.Info
		m.Game = &g
	}
	if m.Type != message.CreateGame { 
		m.Game.ID = s.game.ID()
	}
	messageJSON, err := json.Marshal(m)
	if err != nil {
		s.log.Error("marshalling socket message to send: " + err.Error())
		return
	}
	s.webSocket.Call("send", string(messageJSON))
}
func ( s * Socket ) Send ( m message . Message ) { if ! s . isOpen ( ) { s . log . Error ( " " ) return } if m . Game == nil { var g game . Info m . Game = & g } if m . Type != message . CreateGame { m . Game . ID = s . game . ID ( ) } messageJSON , err := json . Marshal ( m ) if err != nil { s . log . Error ( " " + err . Error ( ) ) return } s . webSocket . Call ( " " , string ( messageJSON ) ) }
Send delivers a message to the server via it's websocket.
Send delivers a message to the server via it ' s websocket .
// all messages except CREATE are for a specific game