22 lines
323 B
Go
22 lines
323 B
Go
package main
|
|
|
|
import (
|
|
"code.google.com/p/go.net/websocket"
|
|
)
|
|
|
|
type Spectator struct {
|
|
ws *websocket.Conn
|
|
send chan *boardstate
|
|
}
|
|
|
|
func (s *Spectator) sender() {
|
|
for things := range s.send {
|
|
// log.Printf("%v\n", things)
|
|
err := websocket.JSON.Send(s.ws, *things)
|
|
if err != nil {
|
|
break
|
|
}
|
|
}
|
|
s.ws.Close()
|
|
}
|