server/spectator.go

23 lines
331 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-11-13 22:24:54 -08:00
send chan Message
2013-08-19 22:23:35 -07:00
}
func (s *Spectator) sender() {
for things := range s.send {
2013-11-13 22:24:54 -08:00
err := websocket.JSON.Send(s.ws, things)
2013-08-19 22:23:35 -07:00
if err != nil {
break
}
}
s.ws.Close()
log.Printf("Spectator sender close")
2013-08-19 22:23:35 -07:00
}