mirror of
https://github.com/statbate/supreme-disco.git
synced 2026-08-11 03:22:41 +00:00
update
This commit is contained in:
parent
9fe159f6f3
commit
12e5ac6f68
5 changed files with 242 additions and 0 deletions
26
server/main.go
Normal file
26
server/main.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
go broadcast()
|
||||
go startSocket()
|
||||
|
||||
http.HandleFunc("/ws/", wsHandler)
|
||||
|
||||
const SOCK = "/tmp/ws.sock"
|
||||
removeSocket(SOCK)
|
||||
unixListener, err := net.Listen("unix", SOCK)
|
||||
if err != nil {
|
||||
log.Fatal("Listen (ws socket): ", err)
|
||||
}
|
||||
defer unixListener.Close()
|
||||
os.Chmod(SOCK, 0777)
|
||||
log.Fatal(http.Serve(unixListener, nil))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue