ing
This commit is contained in:
parent
0d428d20c0
commit
e759caacb7
@ -1,6 +1,6 @@
|
||||
{
|
||||
"server": {
|
||||
"ip": "localhost",
|
||||
"ip": "127.0.0.1",
|
||||
"port": 18081,
|
||||
"tls": false
|
||||
},
|
||||
|
2
main.go
2
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)
|
||||
|
@ -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)
|
||||
|
@ -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 {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user