This commit is contained in:
khlieng 2015-01-17 02:37:21 +01:00
commit 508a04cf4c
30 changed files with 1545 additions and 0 deletions

24
websocket.go Normal file
View file

@ -0,0 +1,24 @@
package main
import (
"golang.org/x/net/websocket"
)
type WebSocket struct {
conn *websocket.Conn
In chan []byte
}
func NewWebSocket(ws *websocket.Conn) *WebSocket {
return &WebSocket{
conn: ws,
In: make(chan []byte, 32),
}
}
func (w *WebSocket) write() {
for data := range w.In {
w.conn.Write(data)
}
}