diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2019-04-16 12:59:39 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2019-04-16 12:59:39 +0200 |
| commit | 16ed63820f488c20475746e628393fbb3f6d608d (patch) | |
| tree | 9466c7b41bdba1a2883dd237f2bde5bcc4b95c51 /gui/src | |
| parent | 07df6028b848c17cb150cf7eff2f6dbc9e49acd7 (diff) | |
| parent | a985dfc08ef33a9c6bbaf2e8cf4ac67b1ffa3f72 (diff) | |
| download | mullvadvpn-16ed63820f488c20475746e628393fbb3f6d608d.tar.xz mullvadvpn-16ed63820f488c20475746e628393fbb3f6d608d.zip | |
Merge branch 'retire-jsonstream'
Diffstat (limited to 'gui/src')
| -rw-r--r-- | gui/src/main/jsonrpc-client.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gui/src/main/jsonrpc-client.ts b/gui/src/main/jsonrpc-client.ts index 0a6ada62d8..34e4797442 100644 --- a/gui/src/main/jsonrpc-client.ts +++ b/gui/src/main/jsonrpc-client.ts @@ -2,8 +2,8 @@ import assert from 'assert'; import log from 'electron-log'; import { EventEmitter } from 'events'; import jsonrpc from 'jsonrpc-lite'; -import JSONStream from 'JSONStream'; import * as net from 'net'; +import StreamValues from 'stream-json/streamers/StreamValues'; import * as uuid from 'uuid'; export interface IUnansweredRequest { @@ -325,7 +325,7 @@ export class SocketTransport implements ITransport<{ path: string }> { public connect(options: { path: string }) { assert(!this.connection, 'Make sure to close the existing socket'); - const jsonStream = JSONStream.parse(null) + const jsonStream = StreamValues.withParser() .on('data', this.onJsonStreamData) .once('error', this.onJsonStreamError); @@ -406,8 +406,8 @@ export class SocketTransport implements ITransport<{ path: string }> { } }; - private onJsonStreamData = (data: object) => { - this.onMessage(data); + private onJsonStreamData = (data: { key: number; value: any }) => { + this.onMessage(data.value); }; private onJsonStreamError = (error: Error) => { |
