Change how server address is specified
now you spell it as such: gobot -addr wss://hackerbots.us gobot -addr ws://localhost:8666
This commit is contained in:
@@ -11,9 +11,9 @@ import (
|
||||
"hackerbots.us/server"
|
||||
)
|
||||
|
||||
func connect(server string, port int) (*websocket.Conn, error) {
|
||||
func connect(addr string) (*websocket.Conn, error) {
|
||||
origin := "http://localhost/"
|
||||
url := fmt.Sprintf("ws://%s:%d/ws/", server, port)
|
||||
url := fmt.Sprintf("%s/ws/", addr)
|
||||
return websocket.Dial(url, "", origin)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ type Client struct {
|
||||
ForceJSON bool
|
||||
GameId string
|
||||
Name string
|
||||
Port int
|
||||
Server string
|
||||
StatsReq server.StatsRequest
|
||||
Game server.GameParam
|
||||
@@ -53,7 +52,7 @@ type decoder interface {
|
||||
|
||||
// Negotiate runs through the hackerbots negociation protocol.
|
||||
func (c *Client) Negotiate(clientType string, player Player) (err error) {
|
||||
c.ws, err = connect(c.Server, c.Port)
|
||||
c.ws, err = connect(c.Server)
|
||||
if err != nil {
|
||||
return errors.New(fmt.Sprintf("connection failure: %s", err))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user