1
0
Fork 0
mirror of https://github.com/sourcegraph/jsonrpc2.git synced 2026-06-16 04:04:56 +02:00
Commit graph

18 commits

Author SHA1 Message Date
Quinn Slack
375ca94e9c add go module, simplify some cleanups 2019-11-02 21:39:58 -07:00
s3rj1k
456318691a fix some golangci-lint, revive linter warnings
Signed-off-by: s3rj1k <evasive.gyron@gmail.com>
2019-11-02 22:31:31 +02:00
Ggicci
3e2e814648 fix: don't apply nil CallOption and ConnOpt 2019-01-07 01:47:28 +08:00
Keegan Carruthers-Smith
a3d86c792f allow multiple OnRecv and OnSend 2018-05-01 19:02:17 +01:00
Ondřej Kupka
c6c7b9aa99 Response: Add omitempty tag for Result (#14)
The 'result' key MUST be unset according when the error key is set.
This is not what is happening right now. When the error is set,
"result":null is returned in the response payload. This patch is fixing
the issue by adding omitempty for the result field.
2017-08-02 20:50:46 +02:00
Keegan Carruthers-Smith
3a7c446248 Handle is blocking (#12)
NOTE: This is a breaking change to the expected contract of Handler. Please update your implementation to use AsyncHandler if needs be.

We have strict ordering requirements of how we handle FileSystem requests in
LSP. As such relying on the ordering the goroutine scheduler runs requests in
leads to potential out of order mutations to the FS. As such we update the
jsonrpc2 implementation to by default block until Handle returns (note it can
still respond to the request at a later stage). For more simple use cases we
provide the AsyncHandler which will work like the previous implementation.

* Ensure handle is blocking
2017-02-21 14:25:50 +02:00
Keegan Carruthers-Smith
955f217b74 Add Meta field to Response (#10) 2017-02-20 14:21:08 +02:00
Keegan Carruthers-Smith
4fb7cd9079 Add CallOpt SetID
SetID allows a caller to control the ID of the request. Previously it was
impossible to set the ID of a call.
2017-01-31 11:08:53 +02:00
Quinn Slack
cffa092597 better null handling in (Request).params and (Response).result (#7)
This makes the MarshalJSON/UnmarshalJSON methods centralize the logic, instead of requiring callers to occasionally munge responses to make them valid to later JSON-marshal.
2017-01-26 02:18:31 -08:00
Quinn Slack
64d0b93a7a propagate JSON "null" result instead of treating it as Go nil (and field-not-present in JSON) 2017-01-22 16:05:00 -08:00
Quinn Slack
a61d8f7bd7 warn when marshaling invalid Response 2017-01-22 15:45:18 -08:00
Quinn Slack
d58e8cc226 support responses with null result ({"result":null})
Previously, we incorrectly interpreted these as neither a request nor a response, and we printed an error for them. This is incorrect behavior per JSON-RPC 2.0 spec; responses can have a null result.
2017-01-22 15:34:05 -08:00
Quinn Slack
6e06d561ec Add pluggable transport interface + WebSocket support
simplify API by using interface{}, rename from transport -> stream

add WebSocket transport in websocket subpackage

do not buffer in ReadObject, rename GetObjectReader/ReadObject -> NextObjectReader

use xtest (jsonrpc2_test) package to allow us to test subpackages that depend on us (in a future change)

factor out vscode-specific transport code and allow pluggable transports

remove Server (unused) and Serve (unnecessary):
  The Serve func had nothing specific to JSON-RPC; it was just a loop
  around (net.Listener).Accept. It added no value.
2016-12-17 18:35:34 -08:00
Richard Musiol
9fdd802ab4
make call.done channel buffered so it can discard its value if the call got cancelled 2016-11-22 13:21:59 +01:00
Quinn Slack
6416f80f8f support string request IDs (in addition to numeric request IDs) 2016-11-06 07:12:05 -08:00
Quinn Slack
0328ebe20e remove incomplete JSON-RPC 2.0 batch support 2016-11-06 06:51:04 -08:00
Beyang Liu
3b45ab3a66 add JSONRPC2 interface 2016-10-28 16:33:31 -07:00
Quinn Slack
c04eec1600 initial commit 2016-10-11 15:56:18 +02:00