Ethan Buchman
9dde1a0bd4
rpc: comments
7 years ago
Anton Kaliaev
2fd8496bc1
correct handling of pings and pongs
server:
- always has read & write timeouts
- ping handler never blocks the reader (see A)
- sends regular pings to check up on a client
A:
at some point server write buffer can become full, so in order not to
block reads from a client (see
https://github.com/gorilla/websocket/issues/97 ), server may skip some
pongs. As a result, client may disconnect. But you either have to do
that or block the reader. There is no third way.
client:
- optional read & write timeouts
- optional ping/pong to measure latency
7 years ago
Anton Kaliaev
9b5f21a650
[ws-server] reset readTimeout when we receive something
7 years ago
Anton Kaliaev
6c85e4be4f
change server ping period to be less frequent
no need to ping ws every 10 sec
7 years ago
Anton Kaliaev
c14b39da5f
make RPC server's ping period and pong wait configurable via options
7 years ago
Ethan Buchman
0d1fa8e884
fixes from review
8 years ago
Ethan Buchman
e2ed15fa02
rpc: SetWriteDeadline for ws ping. fixes #553
8 years ago
Ethan Buchman
b6031d5f4b
rpc/lib: set logger on ws conn
8 years ago
Anton Kaliaev
b4ece65726
standardize key for errors (should be "err")
8 years ago
Ethan Frey
2b324b7eb9
RPC returns pretty formated json
8 years ago
Anton Kaliaev
f803544195
new logging
8 years ago
Ethan Buchman
75989342b0
fixes from rebase
8 years ago
Ethan Buchman
9860c8fee1
rpc: cleanup some comments [ci skip]
8 years ago
Ethan Frey
4a1b714ca4
All tests pass without go-wire json ptr madness
8 years ago
Ethan Frey
6ba799132c
json.RawMessage in RPCRequest to defer parsing
8 years ago
Ethan Buchman
ac28b12fa8
add readReflectJSON from wire
8 years ago
Ethan Buchman
acfbea6d49
rpc: decode args without wire
8 years ago
Ethan Frey
6c60c07f16
BROKEN: attempt to replace go-wire.JSON with json.Unmarshall in rpc
8 years ago
Ethan Buchman
cc6dde96c1
rpc -> rpc/lib and rpc/tendermint -> rpc
8 years ago
Ethan Buchman
9851265d4f
rpc: use HTTP error codes
8 years ago
Ethan Buchman
9e82d132ce
go-rpc -> tendermint/rpc
8 years ago
Ethan Buchman
c55d83281a
move into rpc package
8 years ago
Ethan Buchman
15d5b2ac49
use tmlibs
8 years ago
Ethan Buchman
a01cff9ce6
jsonParamsToArgsRPC func
8 years ago
Anton Kaliaev
d6fd0c4ca0
fix backward compatibility for WS
8 years ago
Ethan Buchman
8c38543357
fix error msg
8 years ago
Ethan Buchman
c3295f4878
RPCRequest.Params can be map[string]interface{} or []interface{}
8 years ago
Ethan Frey
9d18cbe74e
Remove race condition between read go-routine and stop
8 years ago
Anton Kaliaev
afc39febed
close ws connection on Stop
8 years ago
Anton Kaliaev
db69845ded
introduce errors pkg
8 years ago
Anton Kaliaev
ff90224ba8
fix "Expected map but got type string" error
Error from tendermint:
```
panic: Expected map but got type string [recovered]
panic: Expected map but got type string
goroutine 82 [running]:
testing.tRunner.func1(0xc420464000)
/usr/local/go/src/testing/testing.go:622 +0x29d
panic(0xa1fda0, 0xc4201eecd0)
/usr/local/go/src/runtime/panic.go:489 +0x2cf
github.com/tendermint/tendermint/rpc/test.waitForEvent(0xc420464000, 0xc420064000, 0xae6fae, 0x8, 0xae6f01, 0xc2e998, 0xc2e9a0)
/home/vagrant/go/src/github.com/tendermint/tendermint/rpc/test/helpers.go:179 +0x53a
github.com/tendermint/tendermint/rpc/test.TestWSNewBlock(0xc420464000)
/home/vagrant/go/src/github.com/tendermint/tendermint/rpc/test/client_test.go:190 +0x12e
testing.tRunner(0xc420464000, 0xc2e9a8)
/usr/local/go/src/testing/testing.go:657 +0x96
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:697 +0x2ca
```
8 years ago
Anton Kaliaev
1ddb60b6e7
refactor jsonParamsToArgs
Suggested in https://github.com/tendermint/go-rpc/pull/9#discussion_r105098390
8 years ago
Anton Kaliaev
fed84f875c
fix jsonParamsToArgsWS index error
Error from tendermint:
```
panic: runtime error: index out of range
goroutine 82 [running]:
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-rpc/server.jsonParamsToArgsWS(0xc4200960e0, 0xc42024d4a0, 0xc420215380, 0x3, 0x0, 0x0, 0xc420215383, 0x9, 0xc42024d4a0, 0xf1ecc0, ...)
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-rpc/server/handlers.go:184 +0x654
github.com/tendermint/tendermint/vendor/github.com/tendermint/go-rpc/server.(*wsConnection).readRoutine(0xc4201fd0e0)
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-rpc/server/handlers.go:496 +0x3a9
created by github.com/tendermint/tendermint/vendor/github.com/tendermint/go-rpc/server.(*wsConnection).OnStart
/home/vagrant/go/src/github.com/tendermint/tendermint/vendor/github.com/tendermint/go-rpc/server/handlers.go:377 +0x45
```
8 years ago
Anton Kaliaev
2dc6ab3896
use golang default if an arg is missing (Refs #7 )
8 years ago
Anton Kaliaev
e1d5873bdf
support key-value params in JSONRPC (Refs #1 )
More changes:
- remove Client interface (reason: empty)
- introduce HTTPClient interface, which can be used for both ClientURI
and ClientJSONRPC clients (so our users don't have to create their own) (Refs #8 )
- rename integration tests script to `integration_test.sh`
- do not update deps on `get_deps`
8 years ago
Matt Bell
86506cd4f8
Handle quoted and hex string type HTTP args for both 'string' and '[]byte' type function args
8 years ago
Matt Bell
34a806578a
Handle hex strings and quoted strings in HTTP params
Use 0x-prefixed hex strings in client
server: Decode hex string args
Encode all string args as 0x<hex> without trying to encode as JSON
Added tests for special string arguments
Fix server handling quoted string args
Added string arg handling test cases to bash test script
8 years ago
Jae Kwon
161e36fd56
QuitService->BaseService
8 years ago
Ethan Buchman
855255d73e
use EventSwitch interface; less logging
8 years ago
Ethan Buchman
39ee59c26e
server: return result with error
9 years ago
Ethan Buchman
e8538d606a
add blank client interface
9 years ago
Jae Kwon
8b7969d6ea
Add comments about goroutine-safety
9 years ago
Ethan Buchman
aff561d8c3
RPCResponse.Result is json.RawMessage
9 years ago
Ethan Buchman
0bcae125c2
use comma separated string for arg names
9 years ago
Ethan Buchman
3d59e13dd8
move from tendermint/tendermint
9 years ago