Init
This commit is contained in:
commit
508a04cf4c
30 changed files with 1545 additions and 0 deletions
24
websocket.go
Normal file
24
websocket.go
Normal 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)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue