| // Copyright 2013 The Gorilla WebSocket Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| var addr = flag.String("addr", ":8080", "http service address") |
| func serveHome(w http.ResponseWriter, r *http.Request) { |
| http.Error(w, "Not found", 404) |
| http.Error(w, "Method not allowed", 405) |
| http.ServeFile(w, r, "home.html") |
| http.HandleFunc("/", serveHome) |
| http.HandleFunc("/ws", func(w http.ResponseWriter, r *http.Request) { |
| err := http.ListenAndServe(*addr, nil) |
| log.Fatal("ListenAndServe: ", err) |