Add context initializing and fix error when creating connection (assigning to nil map)

This commit is contained in:
ChronosX88 2020-02-10 14:44:40 +04:00
parent a5e6fa72ff
commit 5e094d6c45
2 changed files with 4 additions and 1 deletions

View File

@ -17,6 +17,7 @@ var upgrader = websocket.Upgrader{
}
func main() {
internal.InitializeContext("localhost")
router := mux.NewRouter()
router.HandleFunc("/", func(response http.ResponseWriter, request *http.Request) {
response.Write([]byte("Zirconium server is up and running!"))

View File

@ -12,7 +12,9 @@ type ConnectionHandler struct {
}
func NewConnectionHandler() *ConnectionHandler {
return &ConnectionHandler{}
return &ConnectionHandler{
connections: make(map[string]*OriginC2S),
}
}
func (ch *ConnectionHandler) HandleNewConnection(wsocket *websocket.Conn) {