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

23 commits

Author SHA1 Message Date
Keegan Carruthers-Smith
277d2464cf ci: disable testing tip (#11)
It is failing the tests. This may actually be an underlying issue in the tests,
but not a big deal to fix now.
2017-02-20 04:55:33 -08:00
Keegan Carruthers-Smith
955f217b74 Add Meta field to Response (#10) 2017-02-20 14:21:08 +02:00
Quinn Slack
7ea7528660 add badge 2017-02-08 11:48:48 -08:00
Quinn Slack
0ad9fd8995 synchronize writes in BufferedObjectStream (#9)
Running various applications that use jsonrpc2 with the Go race detector shows that there is a race condition where `WriteObject` can be called from concurrent goroutines (e.g., 1 sending a request, 1 writing a response).
2017-01-31 23:39:03 -08:00
Keegan Carruthers-Smith
4f06164e9a Merge pull request #8 from sourcegraph/k/set-id
Add CallOpt SetID
2017-01-31 11:16:41 +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
6e88a787fb Merge pull request #6 from sourcegraph/explicit-null
support responses with null result ({"result":null})
2017-01-23 19:55:20 -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
9edf388fe1 do not suppress error in TestAnyMessage 2017-01-22 15:34:24 -08:00
Quinn Slack
c0f3aff61f remove incorrect special handling of null results
It is not correct in general to convert null results in JSON-RPC 2.0 responses to `{}`.
2017-01-22 15:34:08 -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
Keegan Carruthers-Smith
7e53931322 Use correct format string for ID
Audited all calls for Printf. Noticed the following in some logs

```
jsonrpc2 handler: sending response {1 %!d(string=) %!d(bool=false)}: jsonrpc2: connection is closed
```
2016-11-14 21:17:22 +02:00
Quinn Slack
bc55a64572 Merge pull request #2 from sourcegraph/support-string-ids
support string request IDs (and numeric request IDs)
2016-11-06 07:17:36 -08: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
Nico Tonozzi
2e4214c77b Send something over the wire for responses
I accidentally made this change in the main repo, instead of here.

This ensures that the server can tell the difference between a response and a request. The old method (resp == nil) didn't work because we use interfaces here, and the interfaces would often have types, but not values.
2016-10-28 16:46:40 -07:00
Beyang Liu
3b45ab3a66 add JSONRPC2 interface 2016-10-28 16:33:31 -07:00
Quinn Slack
efb0c1941c ci: use go 1.7.1, 'release' is not valid 2016-10-11 16:13:48 +02:00
Quinn Slack
c04eec1600 initial commit 2016-10-11 15:56:18 +02:00