mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-23 16:50: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)
|
||||
|
||||
var btu baseTilesUpdates
|
||||
|
||||
if playersFIFO != "" {
|
||||
plys := newPlayers(playersFIFO)
|
||||
go plys.run()
|
||||
router.Path("/players").Methods("GET").Handler(plys)
|
||||
}
|
||||
var wsf *websocketForwarder
|
||||
|
||||
if websockets {
|
||||
wsf := newWebsocketForwarder()
|
||||
wsf = newWebsocketForwarder()
|
||||
go wsf.run()
|
||||
router.Path("/ws").Methods("GET").Handler(wsf)
|
||||
btu = wsf
|
||||
}
|
||||
|
||||
if playersFIFO != "" {
|
||||
plys := newPlayers(playersFIFO, wsf)
|
||||
go plys.run()
|
||||
router.Path("/players").Methods("GET").Handler(plys)
|
||||
}
|
||||
|
||||
if redisHost != "" {
|
||||
var colors *common.Colors
|
||||
var err error
|
||||
|
@ -4,10 +4,11 @@ import "net/http"
|
||||
|
||||
type players struct {
|
||||
fifo string
|
||||
wsf *websocketForwarder
|
||||
}
|
||||
|
||||
func newPlayers(fifo string) *players {
|
||||
return &players{fifo: fifo}
|
||||
func newPlayers(fifo string, wsf *websocketForwarder) *players {
|
||||
return &players{fifo: fifo, wsf: wsf}
|
||||
}
|
||||
|
||||
func (ps *players) run() {
|
||||
|
Loading…
Reference in New Issue
Block a user