mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-24 17:20:18 +01:00
Added command line flags for websocket support. Added dummy websocket controller.
This commit is contained in:
parent
d871808b92
commit
83cf9dbaad
26
cmd/mtwebmapper/forwardupdates.go
Normal file
26
cmd/mtwebmapper/forwardupdates.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright 2014 by Sascha L. Teichmann
|
||||||
|
// Use of this source code is governed by the MIT license
|
||||||
|
// that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "net/http"
|
||||||
|
|
||||||
|
type websocketForwarder struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func newWebsocketForwarder() *websocketForwarder {
|
||||||
|
return &websocketForwarder{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (wsf *websocketForwarder) run() {
|
||||||
|
// TODO: Implement me!
|
||||||
|
}
|
||||||
|
|
||||||
|
func (wsf *websocketForwarder) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||||
|
// TODO: Implement me!
|
||||||
|
}
|
||||||
|
|
||||||
|
func (wsf *websocketForwarder) BaseTilesUpdated(changes map[xz]bool) {
|
||||||
|
// TODO: Implement me!
|
||||||
|
}
|
@ -28,6 +28,7 @@ func main() {
|
|||||||
workers int
|
workers int
|
||||||
transparent bool
|
transparent bool
|
||||||
updateHosts string
|
updateHosts string
|
||||||
|
websockets bool
|
||||||
)
|
)
|
||||||
flag.IntVar(&webPort, "web-port", 8808, "port of the web server")
|
flag.IntVar(&webPort, "web-port", 8808, "port of the web server")
|
||||||
flag.IntVar(&webPort, "p", 8808, "port of the web server (shorthand)")
|
flag.IntVar(&webPort, "p", 8808, "port of the web server (shorthand)")
|
||||||
@ -50,6 +51,8 @@ func main() {
|
|||||||
flag.StringVar(&colorsFile, "c", "colors.txt", "colors used to render map tiles (shorthand).")
|
flag.StringVar(&colorsFile, "c", "colors.txt", "colors used to render map tiles (shorthand).")
|
||||||
flag.BoolVar(&transparent, "transparent", false, "Render transparent blocks.")
|
flag.BoolVar(&transparent, "transparent", false, "Render transparent blocks.")
|
||||||
flag.BoolVar(&transparent, "t", false, "Render transparent blocks (shorthand).")
|
flag.BoolVar(&transparent, "t", false, "Render transparent blocks (shorthand).")
|
||||||
|
flag.BoolVar(&websockets, "websockets", false, "Forward tile changes to clients via websockets.")
|
||||||
|
flag.BoolVar(&websockets, "ws", false, "Forward tile changes to clients via websockets (shorthand).")
|
||||||
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
@ -58,9 +61,15 @@ func main() {
|
|||||||
subBaseLine := newSubBaseLine(mapDir)
|
subBaseLine := newSubBaseLine(mapDir)
|
||||||
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)
|
||||||
|
|
||||||
// TODO: Implement me!
|
|
||||||
var btu baseTilesUpdates
|
var btu baseTilesUpdates
|
||||||
|
|
||||||
|
if websockets {
|
||||||
|
wsf := newWebsocketForwarder()
|
||||||
|
go wsf.run()
|
||||||
|
router.Path("/ws").Methods("GET").Handler(wsf)
|
||||||
|
btu = wsf
|
||||||
|
}
|
||||||
|
|
||||||
if redisHost != "" {
|
if redisHost != "" {
|
||||||
var colors *common.Colors
|
var colors *common.Colors
|
||||||
var err error
|
var err error
|
||||||
|
Loading…
Reference in New Issue
Block a user