mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-24 01:00:18 +01:00
Wire websocket forwarder with players updater.
This commit is contained in:
parent
ece8924355
commit
da51389935
@ -65,20 +65,21 @@ func main() {
|
|||||||
router.Path("/map/{z:[0-9]+}/{x:[0-9]+}/{y:[0-9]+}.png").Handler(subBaseLine)
|
router.Path("/map/{z:[0-9]+}/{x:[0-9]+}/{y:[0-9]+}.png").Handler(subBaseLine)
|
||||||
|
|
||||||
var btu baseTilesUpdates
|
var btu baseTilesUpdates
|
||||||
|
var wsf *websocketForwarder
|
||||||
if playersFIFO != "" {
|
|
||||||
plys := newPlayers(playersFIFO)
|
|
||||||
go plys.run()
|
|
||||||
router.Path("/players").Methods("GET").Handler(plys)
|
|
||||||
}
|
|
||||||
|
|
||||||
if websockets {
|
if websockets {
|
||||||
wsf := newWebsocketForwarder()
|
wsf = newWebsocketForwarder()
|
||||||
go wsf.run()
|
go wsf.run()
|
||||||
router.Path("/ws").Methods("GET").Handler(wsf)
|
router.Path("/ws").Methods("GET").Handler(wsf)
|
||||||
btu = wsf
|
btu = wsf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if playersFIFO != "" {
|
||||||
|
plys := newPlayers(playersFIFO, wsf)
|
||||||
|
go plys.run()
|
||||||
|
router.Path("/players").Methods("GET").Handler(plys)
|
||||||
|
}
|
||||||
|
|
||||||
if redisHost != "" {
|
if redisHost != "" {
|
||||||
var colors *common.Colors
|
var colors *common.Colors
|
||||||
var err error
|
var err error
|
||||||
|
@ -4,10 +4,11 @@ import "net/http"
|
|||||||
|
|
||||||
type players struct {
|
type players struct {
|
||||||
fifo string
|
fifo string
|
||||||
|
wsf *websocketForwarder
|
||||||
}
|
}
|
||||||
|
|
||||||
func newPlayers(fifo string) *players {
|
func newPlayers(fifo string, wsf *websocketForwarder) *players {
|
||||||
return &players{fifo: fifo}
|
return &players{fifo: fifo, wsf: wsf}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ps *players) run() {
|
func (ps *players) run() {
|
||||||
|
Loading…
Reference in New Issue
Block a user