24 lines
441 B
Go
24 lines
441 B
Go
package socket
|
|
|
|
import (
|
|
"github.com/gorilla/websocket"
|
|
)
|
|
|
|
var displays = make(map[*websocket.Conn]bool)
|
|
|
|
func onNewDisplay(who *websocket.Conn) {
|
|
displays[who] = true
|
|
}
|
|
|
|
func onDisplayMessage(who *websocket.Conn, msg string) {
|
|
}
|
|
|
|
func onDisplayDisconnect(who *websocket.Conn) {
|
|
delete(displays, who)
|
|
}
|
|
|
|
func sendDisplayMessage(msg string) {
|
|
for display := range displays {
|
|
display.WriteMessage(websocket.TextMessage, []byte(msg))
|
|
}
|
|
} |