Start.go 479 B

1234567891011121314151617181920
  1. package server
  2. import (
  3. "log"
  4. "net/http"
  5. "strconv"
  6. )
  7. // Start the HTTP and WebSocket server
  8. func (server *Server) Start() {
  9. // Declare ourselves up and running to the console.
  10. log.Println("Started sudoku-funpark server")
  11. // Start the http server
  12. http.HandleFunc("/json", server.jsonDumper)
  13. // Start the websocket server
  14. http.HandleFunc("/ws", server.handleConnections)
  15. log.Fatal(http.ListenAndServe(server.ListenAddress+":"+strconv.Itoa(server.ListenPort), nil))
  16. }