2017-05-11 13:04:43 +00:00
|
|
|
// +build no_ws
|
|
|
|
|
2018-03-08 03:59:47 +00:00
|
|
|
package common
|
2017-05-11 13:04:43 +00:00
|
|
|
|
2017-06-10 07:58:15 +00:00
|
|
|
import "errors"
|
2017-05-11 13:04:43 +00:00
|
|
|
import "net/http"
|
|
|
|
|
2017-09-13 15:09:13 +00:00
|
|
|
// TODO: Disable WebSockets on high load? Add a Control Panel interface for disabling it?
|
2018-03-08 03:59:47 +00:00
|
|
|
var EnableWebsockets = false // Put this in caps for consistency with the other constants?
|
2017-09-13 15:09:13 +00:00
|
|
|
|
|
|
|
var wsHub WSHub
|
2017-09-10 16:57:22 +00:00
|
|
|
var errWsNouser = errors.New("This user isn't connected via WebSockets")
|
2017-05-11 13:04:43 +00:00
|
|
|
|
2018-03-21 05:56:33 +00:00
|
|
|
type WSHub struct{}
|
2017-05-11 13:04:43 +00:00
|
|
|
|
2018-03-21 05:56:33 +00:00
|
|
|
func (_ *WSHub) guestCount() int { return 0 }
|
2017-05-11 13:04:43 +00:00
|
|
|
|
2018-03-21 05:56:33 +00:00
|
|
|
func (_ *WSHub) userCount() int { return 0 }
|
2017-05-11 13:04:43 +00:00
|
|
|
|
2018-03-21 05:56:33 +00:00
|
|
|
func (hub *WSHub) broadcastMessage(_ string) error { return nil }
|
2017-06-10 07:58:15 +00:00
|
|
|
|
2017-09-13 15:09:13 +00:00
|
|
|
func (hub *WSHub) pushMessage(_ int, _ string) error {
|
2022-02-21 03:32:53 +00:00
|
|
|
return errWsNouser
|
2017-06-10 07:58:15 +00:00
|
|
|
}
|
|
|
|
|
2017-09-13 15:09:13 +00:00
|
|
|
func (hub *WSHub) pushAlert(_ int, _ int, _ string, _ string, _ int, _ int, _ int) error {
|
2022-02-21 03:32:53 +00:00
|
|
|
return errWsNouser
|
2017-06-10 07:58:15 +00:00
|
|
|
}
|
|
|
|
|
2017-09-13 15:09:13 +00:00
|
|
|
func (hub *WSHub) pushAlerts(_ []int, _ int, _ string, _ string, _ int, _ int, _ int) error {
|
2022-02-21 03:32:53 +00:00
|
|
|
return errWsNouser
|
2017-06-12 09:03:14 +00:00
|
|
|
}
|
|
|
|
|
2018-03-21 05:56:33 +00:00
|
|
|
func RouteWebsockets(_ http.ResponseWriter, _ *http.Request, _ User) {}
|