|
|
|
@ -11,6 +11,8 @@ import (
@@ -11,6 +11,8 @@ import (
|
|
|
|
|
|
|
|
|
|
var ipfs icore.CoreAPI |
|
|
|
|
var configuration = getConfig() |
|
|
|
|
var server *Server |
|
|
|
|
|
|
|
|
|
var online = false |
|
|
|
|
|
|
|
|
|
func main() { |
|
|
|
@ -46,7 +48,7 @@ func startChatServer() {
@@ -46,7 +48,7 @@ func startChatServer() {
|
|
|
|
|
// log.SetFlags(log.Lshortfile)
|
|
|
|
|
|
|
|
|
|
// websocket server
|
|
|
|
|
server := NewServer("/entry") |
|
|
|
|
server = NewServer("/entry") |
|
|
|
|
go server.Listen() |
|
|
|
|
|
|
|
|
|
// static files
|
|
|
|
@ -61,14 +63,11 @@ func startChatServer() {
@@ -61,14 +63,11 @@ func startChatServer() {
|
|
|
|
|
func getStatus(w http.ResponseWriter, r *http.Request) { |
|
|
|
|
status := Status{ |
|
|
|
|
Online: online, |
|
|
|
|
ViewerCount: server.ClientCount(), |
|
|
|
|
} |
|
|
|
|
json.NewEncoder(w).Encode(status) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type Status struct { |
|
|
|
|
Online bool `json:"online"` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func streamConnected() { |
|
|
|
|
online = true |
|
|
|
|
} |
|
|
|
@ -76,3 +75,9 @@ func streamConnected() {
@@ -76,3 +75,9 @@ func streamConnected() {
|
|
|
|
|
func streamDisconnected() { |
|
|
|
|
online = false |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func viewerAdded() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func viewerRemoved() { |
|
|
|
|
} |
|
|
|
|