go-pulse/rpc
Felix Lange 245f3146c2
rpc: implement full bi-directional communication (#18471)
New APIs added:

    client.RegisterName(namespace, service) // makes service available to server
    client.Notify(ctx, method, args...)     // sends a notification
    ClientFromContext(ctx)                  // to get a client in handler method

This is essentially a rewrite of the server-side code. JSON-RPC
processing code is now the same on both server and client side. Many
minor issues were fixed in the process and there is a new test suite for
JSON-RPC spec compliance (and non-compliance in some cases).

List of behavior changes:

- Method handlers are now called with a per-request context instead of a
  per-connection context. The context is canceled right after the method
  returns.
- Subscription error channels are always closed when the connection
  ends. There is no need to also wait on the Notifier's Closed channel
  to detect whether the subscription has ended.
- Client now omits "params" instead of sending "params": null when there
  are no arguments to a call. The previous behavior was not compliant
  with the spec. The server still accepts "params": null.
- Floating point numbers are allowed as "id". The spec doesn't allow
  them, but we handle request "id" as json.RawMessage and guarantee that
  the same number will be sent back.
- Logging is improved significantly. There is now a message at DEBUG
  level for each RPC call served.
2019-02-04 13:47:34 +01:00
..
testdata rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
client_example_test.go rpc: fix example typo (#18100) 2018-11-14 12:21:10 +02:00
client_test.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
client.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
doc.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
endpoints.go rpc: make HTTP RPC timeouts configurable, raise defaults (#17240) 2018-07-31 12:16:14 +03:00
errors.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
handler.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
http_test.go rpc: enforce the 128KB request limits on websockets too 2018-03-13 13:55:26 +02:00
http.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
inproc.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
ipc_js.go ethdb, rpc: support building on js/wasm (#17709) 2018-10-16 00:47:25 +02:00
ipc_unix.go rpc: Warn the user when the path name is too long for the Unix ipc endpoint (#18330) 2019-01-02 17:33:17 +01:00
ipc_windows.go all: import "context" instead of "golang.org/x/net/context" 2017-03-22 20:49:15 +01:00
ipc.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
json.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
server_test.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
server.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
service.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
stdio.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
subscription_test.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
subscription.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
testservice_test.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
types_test.go all: update license information (#16089) 2018-02-14 13:49:11 +01:00
types.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00
websocket_test.go rpc: enable basic auth for websocket client (#17699) 2018-09-19 18:09:03 +02:00
websocket.go rpc: implement full bi-directional communication (#18471) 2019-02-04 13:47:34 +01:00