server/spectator.go
2013-09-03 23:26:40 -07:00

22 lines
327 B
Go

package main
import (
"bitbucket.org/hackerbots/bot"
"code.google.com/p/go.net/websocket"
)
type Spectator struct {
ws *websocket.Conn
send chan *bot.Boardstate
}
func (s *Spectator) sender() {
for things := range s.send {
err := websocket.JSON.Send(s.ws, *things)
if err != nil {
break
}
}
s.ws.Close()
}