aboutsummaryrefslogtreecommitdiffstats
path: root/packages/connect
diff options
context:
space:
mode:
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));