server/spectator.go

23 lines
336 B
Go
Raw Normal View History

2013-08-19 22:23:35 -07:00
package main
import (
"code.google.com/p/go.net/websocket"
"log"
2013-08-19 22:23:35 -07:00
)
type Spectator struct {
2013-08-19 23:44:00 -07:00
ws *websocket.Conn
2013-09-27 22:27:05 -07:00
send chan *Boardstate
2013-08-19 22:23:35 -07:00
}
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")
2013-08-19 22:23:35 -07:00
}