Add cobra, move the server code into its own package

This commit is contained in:
khlieng 2015-05-01 22:59:46 +02:00
parent bb729a5c8e
commit e63c012aad
57 changed files with 6910 additions and 145 deletions

24
server/websocket.go Normal file
View file

@ -0,0 +1,24 @@
package server
import (
"github.com/khlieng/name_pending/Godeps/_workspace/src/golang.org/x/net/websocket"
)
type WebSocket struct {
conn *websocket.Conn
Out chan []byte
}
func NewWebSocket(ws *websocket.Conn) *WebSocket {
return &WebSocket{
conn: ws,
Out: make(chan []byte, 32),
}
}
func (w *WebSocket) write() {
for {
w.conn.Write(<-w.Out)
}
}