diff --git a/config.json b/config.json index eff8a5a..3e6105f 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "server": { - "ip": "localhost", + "ip": "127.0.0.1", "port": 18081, "tls": false }, diff --git a/debug b/debug index 93a19d8..0506d10 100755 Binary files a/debug and b/debug differ diff --git a/main.go b/main.go index 4b9fe20..2d16c37 100644 --- a/main.go +++ b/main.go @@ -49,7 +49,7 @@ func main() { }) }) - http.Handle("/ws", ws.HTTPHandler()) + http.Handle("/rpc", ws.HTTPHandler()) log.Printf("Address: %s, UseTLS: %t", addr, useTLS) http.ListenAndServe(addr, nil) diff --git a/protocol/jsonrpc/rpc.go b/protocol/jsonrpc/rpc.go index 68742e3..0f8d2ce 100644 --- a/protocol/jsonrpc/rpc.go +++ b/protocol/jsonrpc/rpc.go @@ -57,7 +57,7 @@ type handler struct { // NewRequest returns a CodecRequest. func (h *handler) Handle(data []byte) ([]byte, *protocol.Error) { - req := new(Request) + req := Request{} err := json.Unmarshal(data, &req) if nil != err { return nil, protocol.NewError(protocol.E_PARSE, err, nil) diff --git a/server/client.go b/server/client.go index 1248455..eeaa6ce 100644 --- a/server/client.go +++ b/server/client.go @@ -165,8 +165,11 @@ func (c *client) onMessageReceived(messageType int, r io.Reader) { req := new(Request) err := json.NewDecoder(r).Decode(req) if err != nil { + log.Println(err) } + log.Println(req.Body) + h := c.server.ProtocolHandler(req.Protocol) if nil == h {