Allow connections from all origins.
This commit is contained in:
parent
7da9b2dcb2
commit
516a5fa547
@ -106,7 +106,7 @@ func (game *chessGame) handle() {
|
||||
}
|
||||
|
||||
func addPlayersToGame(players [2]Player) {
|
||||
log.Printf("Adding players \n%d\n%d\nto new game", players[0].id, players[1].id)
|
||||
log.Printf("Adding players %d and %d to new game", players[0].id, players[1].id)
|
||||
game := NewChessGame(rand.Int(), players)
|
||||
|
||||
go game.handle()
|
||||
|
@ -14,6 +14,9 @@ var upgrader = websocket.Upgrader{} // use default options
|
||||
func SocketHandler(w http.ResponseWriter, r *http.Request) {
|
||||
log.Println("SocketHandler invoked")
|
||||
|
||||
// Allow connections from any origin
|
||||
upgrader.CheckOrigin = func(r *http.Request) bool { return true }
|
||||
|
||||
conn, err := upgrader.Upgrade(w, r, nil)
|
||||
if err != nil {
|
||||
log.Print("Error during connection upgrading:", err)
|
||||
|
Loading…
Reference in New Issue
Block a user