allow for overriding encodings
This commit is contained in:
parent
839b5789e3
commit
bb3d9e16e4
1
main.go
1
main.go
@ -29,6 +29,7 @@ var botname = flag.String("name", "gobot", "the name that other players will see
|
|||||||
var botcount = flag.Int("bots", 1, "number of bots to spin up")
|
var botcount = flag.Int("bots", 1, "number of bots to spin up")
|
||||||
|
|
||||||
var verbose = flag.Bool("verbose", false, "run verbosly")
|
var verbose = flag.Bool("verbose", false, "run verbosly")
|
||||||
|
var forceJSON = flag.Bool("json", false, "force json encoding")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
|
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
|
||||||
|
3
robot.go
3
robot.go
@ -99,6 +99,9 @@ func (r *robot) negociate() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
supportedEncs := []string{"bson", "json", "gob"}
|
supportedEncs := []string{"bson", "json", "gob"}
|
||||||
|
if *forceJSON {
|
||||||
|
supportedEncs = []string{"json"}
|
||||||
|
}
|
||||||
err = websocket.JSON.Send(r.ws, supportedEncs)
|
err = websocket.JSON.Send(r.ws, supportedEncs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New(fmt.Sprintf("failure: %+v", err))
|
return errors.New(fmt.Sprintf("failure: %+v", err))
|
||||||
|
Loading…
Reference in New Issue
Block a user