24 lines
363 B
Go
24 lines
363 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)
|
|
log.Printf("%v", things)
|
|
if err != nil {
|
|
break
|
|
}
|
|
}
|
|
s.ws.Close()
|
|
log.Printf("Spectator sender close")
|
|
}
|