From 20e28d6c70a7c4af9f3da2ebda1e81d9f8ba7414 Mon Sep 17 00:00:00 2001 From: Brandon Millman Date: Mon, 4 Dec 2017 23:58:33 -0800 Subject: Add requestId to subscription messages and update json-schemas --- .../connect/src/utils/orderbook_channel_message_parsers.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'packages/connect/src/utils') diff --git a/packages/connect/src/utils/orderbook_channel_message_parsers.ts b/packages/connect/src/utils/orderbook_channel_message_parsers.ts index 9cd160428..486a416ef 100644 --- a/packages/connect/src/utils/orderbook_channel_message_parsers.ts +++ b/packages/connect/src/utils/orderbook_channel_message_parsers.ts @@ -15,28 +15,24 @@ export const orderbookChannelMessageParsers = { const messageObj = JSON.parse(utf8Data); const type: string = _.get(messageObj, 'type'); assert.assert(!_.isUndefined(type), `Message is missing a type parameter: ${utf8Data}`); + assert.isString('type', type); switch (type) { case (OrderbookChannelMessageTypes.Snapshot): { assert.doesConformToSchema('message', messageObj, schemas.relayerApiOrderbookChannelSnapshotSchema); const orderbook = messageObj.payload; typeConverters.convertOrderbookStringFieldsToBigNumber(orderbook); - return { - type, - payload: orderbook, - }; + return messageObj; } case (OrderbookChannelMessageTypes.Update): { assert.doesConformToSchema('message', messageObj, schemas.relayerApiOrderbookChannelUpdateSchema); const order = messageObj.payload; typeConverters.convertOrderStringFieldsToBigNumber(order); - return { - type, - payload: order, - }; + return messageObj; } default: { return { type: OrderbookChannelMessageTypes.Unknown, + requestId: 0, payload: undefined, }; } -- cgit v1.2.3