server/spectator.go
2013-10-20 21:15:23 -07:00

23 lines
336 B
Go

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