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

6 commits

Author SHA1 Message Date
Michał Nowotnik
a896fc3eac
[#57] Fix and deprecate PlainObjectCodec (#58)
This change fixes a bug that causes PlainObjectCodec to
lose additional messages from stream. json.Decoder has
an internal buffer that reads more than one message, but
is discarded after every use. Now PlainObjectCodec reuses
encoder and decoder within a buffered stream, however
using it directly in your code retains the old, incorrect
behaviour.

A user should now use plainObjectStream if he needs
plain JSON-RPC 2.0 stream without headers.
`NewPlainObjectStream` method has been added for this reason.
2022-07-11 15:43:39 +02:00
amyxia
5cdc7d6ccd
fix typo in jsonrpc2/stream.go (#47)
Co-authored-by: xiarui.xr <xiarui.xr@antfin.com>
2021-05-26 14:52:51 +02:00
Sam Herrmann
99f63e011f
Add PlainObjectCodec (#45) 2021-04-26 09:13:34 +02:00
Keegan Carruthers-Smith
2ed59d3304
remove content type from vscode object codec (#18) 2018-03-29 15:25:20 +02: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
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