I seem to be having trouble getting this to work(I control both
sides). So what I've got is something like this:
type Reply struct {
SCR *SendCommandsReply
Error *ErrorReply
}
type SendCommandsReply struct {
Device string
Results []string
}
type ErrorReply struct {
Error string
}
<Server code>
wrapper.SCR = &SendCommandsReply{Device: req.Device, Results: results}
fmt.Printf("wrapper.SCR.Device: %s\n", wrapper.SCR.Device)
fmt.Printf("Sending: %v\n", wrapper)
websocket.JSON.Send(ws, wrapper)
<Client code>
var reply interface{}
err := websocket.JSON.Receive(conn, &reply)
if err != nil {
fmt.Printf("Can't receive: %s\n", err)
return
}
On the client side I see:
Can't receive: EOF
On the server side I see:
012/06/12 09:17:39 Received RPC request.
wrapper.SCR.Device: a_device_name
Sending: {0xf84012b8a0 <nil>}
On the server I'm reading into interface{} just to eliminate any
problems with decoding into the correct struct. I must be doing
something wrong now to make it completely stop working.
--John