26 Commits

Author SHA1 Message Date
Silas Davis
f6adddb4a8
Replace ResultsCh with ResponsesCh 2017-10-24 17:45:13 +01:00
Silas Davis
01be6fa309
Fix WSClient blocking in the readRoutine after Stop() as it tries to write to ResultsCh 2017-10-24 13:31:24 +01:00
Silas Davis
3e3d53daef
Make RPCError an actual error and don't swallow its companion data 2017-10-22 15:14:21 +01:00
Anton Kaliaev
45ff7cdd0c rewrite ws client to expose a callback instead of a channel
callback gives more power to the publisher. plus it is optional
comparing to a channel, which will block the whole client if you won't
read from it.
2017-10-02 13:00:20 -04:00
Alexandre Thibault
ce36a0111a rpc: subscribe on reconnection (#689)
* rpc: subscribe on reconnection

* rpc: fix unit tests
2017-10-02 13:00:20 -04:00
Anton Kaliaev
7fadde0b37 check for request ID after receiving it 2017-09-18 16:36:03 -04:00
Anton Kaliaev
e36c79f713 capitalize RpcError 2017-09-18 16:36:03 -04:00
Ethan Buchman
9dde1a0bd4 rpc: comments 2017-08-25 17:57:09 -04:00
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
2017-08-10 17:53:49 -04:00
Anton Kaliaev
236489aecf
backlog must always have higher priority 2017-08-08 19:03:48 -04:00
Ethan Buchman
797acbe911 ws: small comment 2017-08-08 17:33:17 -04:00
Anton Kaliaev
8267920749
[ws-client] write normal close message 2017-08-08 16:02:37 -04:00
Anton Kaliaev
23a87304cc
add a comment for PingPongLatencyTimer [ci skip] 2017-08-08 13:20:58 -04:00
Anton Kaliaev
57eee2466b
make WSClient thread-safe 2017-08-07 17:56:38 -04:00
Anton Kaliaev
5d66d1c28c
fixes from review 2017-08-05 13:11:00 -04:00
Anton Kaliaev
0013053fae
allow to change pong wait and ping period 2017-08-04 10:42:55 -04:00
Anton Kaliaev
1abbb11b44
do not exit from reconnectRoutine! 2017-08-03 22:44:18 -04:00
Anton Kaliaev
54903adeff
add IsReconnecting and IsActive methods 2017-08-03 19:10:15 -04:00
Anton Kaliaev
c08618f7e9
expose latency timer on WSClient 2017-08-03 19:10:14 -04:00
Anton Kaliaev
d578f7f81e
biff up WS client
What's new:
- auto reconnect
- ping/pong
- colored tests
2017-08-03 19:10:14 -04:00
Anton Kaliaev
b4ece65726
standardize key for errors (should be "err") 2017-06-14 12:50:49 +04:00
Anton Kaliaev
f803544195
new logging 2017-05-13 10:24:58 +02:00
Ethan Frey
6ba799132c json.RawMessage in RPCRequest to defer parsing 2017-05-03 16:13:58 +02:00
Ethan Buchman
efeadcc0f4 some cleanup from review 2017-04-28 23:18:38 -04:00
Ethan Frey
6c60c07f16 BROKEN: attempt to replace go-wire.JSON with json.Unmarshall in rpc 2017-04-28 16:24:06 +02:00
Ethan Buchman
cc6dde96c1 rpc -> rpc/lib and rpc/tendermint -> rpc 2017-04-26 19:57:33 -04:00