package player import ( "fmt" "github.com/gorilla/websocket" ) type Player struct { Name string `json:"Name"` Password string `json:"Password"` //Connection Conn *websocket.Conn AuthString string `json:"AuthString"` Level string `json:"Level"` // hidden from user, for balancing purposes Kills int `json:"Kills"` Killed int `json:"Killed"` Won int `json:"Won"` Lost int `json:"Lost"` WinRate int `json:"WinRate"` Health int `json:"Health"` } func (pc *Player) Receiver() { for { fmt.Println("ticker") _, command, err := pc.Conn.ReadMessage() if err != nil { fmt.Println("pc err: " + err.Error()) } pc.Conn.WriteMessage(websocket.TextMessage, []byte("otvet")) fmt.Println(command) } }