2025-01-29 23:20:44 +01:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
"strconv"
|
|
|
|
)
|
|
|
|
|
2025-02-08 15:18:22 +01:00
|
|
|
// Start the HTTP and WebSocket server
|
2025-02-03 21:17:49 +01:00
|
|
|
func (server *Server) Start() {
|
2025-02-08 15:18:22 +01:00
|
|
|
// Declare ourselves up and running to the console.
|
|
|
|
log.Println("Started sudoku-funpark server")
|
2025-01-29 23:20:44 +01:00
|
|
|
|
2025-02-08 15:18:22 +01:00
|
|
|
// Start the http server
|
|
|
|
http.HandleFunc("/json", server.jsonDumper)
|
2025-01-29 23:20:44 +01:00
|
|
|
|
2025-02-08 15:18:22 +01:00
|
|
|
// Start the websocket server
|
|
|
|
http.HandleFunc("/ws", server.handleConnections)
|
|
|
|
log.Fatal(http.ListenAndServe(server.ListenAddress+":"+strconv.Itoa(server.ListenPort), nil))
|
2025-01-29 23:20:44 +01:00
|
|
|
}
|