Esempio n. 1
0
// Simple file server for serving up static content from the /html/ directory
// Also provides a simple id service for AJAX convenience
func main() {
	flag.Parse()
	logutil.ServerStarted("Example")
	pwd, err := os.Getwd()
	if err != nil {
		println(err.Error())
		return
	}
	locserver.StartTreeManager(10000, true)
	http.Handle("/loc", websocket.Handler(locserver.HandleLocationService))
	http.Handle("/msg", websocket.Handler(msgserver.HandleMessageService))
	http.HandleFunc("/id", idProvider)
	http.Handle("/", http.FileServer(http.Dir(pwd+"/html/")))
	portStr := fmt.Sprintf(":%d", *port)
	println(fmt.Sprintf("Listening on port %s", portStr))
	if err := http.ListenAndServe(portStr, nil); err != nil {
		println(err.Error())
	}
}
Esempio n. 2
0
func main() {
	logutil.ServerStarted("Location")
	http.Handle("/loc", websocket.Handler(locserver.HandleLocationService))
	locserver.StartTreeManager(*minTreeMax, *trackMovement)
	http.ListenAndServe(":8002", nil)
}