aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-08-17 07:51:55 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-08-17 07:51:55 +0800
commite079790f7fe82452471fc69fa9583c07848f801d (patch)
tree8301bc0048ae5de6ef83ccb1f9c7c6b572058324 /packages/connect
parent89174cd63fb8c178c33d456d3b9d1d645ee07e91 (diff)
downloaddexon-0x-contracts-e079790f7fe82452471fc69fa9583c07848f801d.tar
dexon-0x-contracts-e079790f7fe82452471fc69fa9583c07848f801d.tar.gz
dexon-0x-contracts-e079790f7fe82452471fc69fa9583c07848f801d.tar.bz2
dexon-0x-contracts-e079790f7fe82452471fc69fa9583c07848f801d.tar.lz
dexon-0x-contracts-e079790f7fe82452471fc69fa9583c07848f801d.tar.xz
dexon-0x-contracts-e079790f7fe82452471fc69fa9583c07848f801d.tar.zst
dexon-0x-contracts-e079790f7fe82452471fc69fa9583c07848f801d.zip
Use uuid as string for requestId
Diffstat (limited to 'packages/connect')
-rw-r--r--packages/connect/package.json2
-rw-r--r--packages/connect/src/ws_orderbook_channel.ts4
2 files changed, 4 insertions, 2 deletions
diff --git a/packages/connect/package.json b/packages/connect/package.json
index 798f839b5..ee08104cf 100644
--- a/packages/connect/package.json
+++ b/packages/connect/package.json
@@ -59,6 +59,7 @@
"lodash": "^4.17.5",
"query-string": "^5.0.1",
"sinon": "^4.0.0",
+ "uuid": "^3.3.2",
"websocket": "^1.0.25"
},
"devDependencies": {
@@ -69,6 +70,7 @@
"@types/mocha": "^2.2.42",
"@types/query-string": "^5.0.1",
"@types/sinon": "^2.2.2",
+ "@types/uuid": "^3.4.3",
"@types/websocket": "^0.0.39",
"async-child-process": "^1.1.1",
"chai": "^4.0.1",
diff --git a/packages/connect/src/ws_orderbook_channel.ts b/packages/connect/src/ws_orderbook_channel.ts
index 3d9230792..425ba8afb 100644
--- a/packages/connect/src/ws_orderbook_channel.ts
+++ b/packages/connect/src/ws_orderbook_channel.ts
@@ -1,4 +1,5 @@
import * as _ from 'lodash';
+import { v4 as uuid } from 'uuid';
import * as WebSocket from 'websocket';
import {
@@ -50,11 +51,10 @@ export class WebSocketOrderbookChannel implements OrderbookChannel {
assert.isOrderbookChannelSubscriptionOpts('subscriptionOpts', subscriptionOpts);
assert.assert(this._client.readyState === WebSocket.w3cwebsocket.OPEN, 'WebSocket connection is closed');
this._subscriptionOptsList.push(subscriptionOpts);
- // TODO: update requestId management to use UUIDs for v2
const subscribeMessage = {
type: 'subscribe',
channel: 'orderbook',
- requestId: this._subscriptionOptsList.length - 1,
+ requestId: uuid(),
payload: subscriptionOpts,
};
this._client.send(JSON.stringify(subscribeMessage));