server/spectator.go

23 lines
331 B
Go

package main
import (
"code.google.com/p/go.net/websocket"
"log"
)
type Spectator struct {
ws *websocket.Conn
send chan Message
}
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")
}