mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-23 16:50: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
|
||||
transparent bool
|
||||
updateHosts string
|
||||
websockets bool
|
||||
)
|
||||
flag.IntVar(&webPort, "web-port", 8808, "port of the web server")
|
||||
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.BoolVar(&transparent, "transparent", false, "Render transparent blocks.")
|
||||
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()
|
||||
|
||||
@ -58,9 +61,15 @@ func main() {
|
||||
subBaseLine := newSubBaseLine(mapDir)
|
||||
router.Path("/map/{z:[0-9]+}/{x:[0-9]+}/{y:[0-9]+}.png").Handler(subBaseLine)
|
||||
|
||||
// TODO: Implement me!
|
||||
var btu baseTilesUpdates
|
||||
|
||||
if websockets {
|
||||
wsf := newWebsocketForwarder()
|
||||
go wsf.run()
|
||||
router.Path("/ws").Methods("GET").Handler(wsf)
|
||||
btu = wsf
|
||||
}
|
||||
|
||||
if redisHost != "" {
|
||||
var colors *common.Colors
|
||||
var err error
|
||||
|
Loading…
Reference in New Issue
Block a user