tardis-machine
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -15,2 +15,3 @@ "use strict"; | ||
async function replayNormalizedWS(ws, req) { | ||
let messages; | ||
try { | ||
@@ -34,3 +35,3 @@ const startTimestamp = new Date().getTime(); | ||
const filterByDataType = helpers_1.constructDataTypeFilter(options); | ||
const messages = messagesIterables.length === 1 ? messagesIterables[0] : tardis_dev_1.combine(...messagesIterables); | ||
messages = messagesIterables.length === 1 ? messagesIterables[0] : tardis_dev_1.combine(...messagesIterables); | ||
// pipe replayed messages through transform stream that filters those if needed and stringifies and then finally trough WebSocket stream | ||
@@ -43,2 +44,6 @@ const webSocketStream = ws_1.default.createWebSocketStream(ws, { decodeStrings: false }); | ||
catch (e) { | ||
// this will underlying open WS connections | ||
if (messages !== undefined) { | ||
messages.return(); | ||
} | ||
ws.close(1011, e.toString()); | ||
@@ -45,0 +50,0 @@ debug_1.debug('WebSocket /ws-replay-normalized error: %o', e); |
@@ -15,2 +15,3 @@ "use strict"; | ||
async function streamNormalizedWS(ws, req) { | ||
let messages; | ||
try { | ||
@@ -34,3 +35,3 @@ const startTimestamp = new Date().getTime(); | ||
const filterByDataType = helpers_1.constructDataTypeFilter(options); | ||
const messages = messagesIterables.length === 1 ? messagesIterables[0] : tardis_dev_1.combine(...messagesIterables); | ||
messages = messagesIterables.length === 1 ? messagesIterables[0] : tardis_dev_1.combine(...messagesIterables); | ||
// pipe streamed messages through transform stream that filters those if needed and stringifies and then finally trough WebSocket stream | ||
@@ -43,2 +44,6 @@ const webSocketStream = ws_1.default.createWebSocketStream(ws, { decodeStrings: false }); | ||
catch (e) { | ||
// this will underlying open WS connections | ||
if (messages !== undefined) { | ||
messages.return(); | ||
} | ||
ws.close(1011, e.toString()); | ||
@@ -45,0 +50,0 @@ debug_1.debug('WebSocket /ws-stream-normalized error: %o', e); |
{ | ||
"name": "tardis-machine", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"engines": { | ||
@@ -18,3 +18,3 @@ "node": ">=12" | ||
"prepare": "npm run build", | ||
"release": "cross-var \"npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish --access=public\"" | ||
"release": "cross-var \"npm run test && npm run build && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish --access=public\"" | ||
}, | ||
@@ -49,5 +49,5 @@ "bin": { | ||
"is-docker": "^2.0.0", | ||
"tardis-dev": "^7.7.5", | ||
"tardis-dev": "^7.7.7", | ||
"ws": "^7.2.0", | ||
"yargs": "^14.2.0" | ||
"yargs": "^14.2.2" | ||
}, | ||
@@ -57,9 +57,9 @@ "devDependencies": { | ||
"@types/jest": "^24.0.23", | ||
"@types/node": "^12.12.7", | ||
"@types/node-fetch": "^2.5.3", | ||
"@types/node": "^12.12.12", | ||
"@types/node-fetch": "^2.5.4", | ||
"@types/split2": "^2.1.6", | ||
"@types/yargs": "^13.0.3", | ||
"bitmex-realtime-api": "^0.4.0", | ||
"bitmex-realtime-api": "^0.4.3", | ||
"cross-var": "^1.1.0", | ||
"husky": "^3.0.9", | ||
"husky": "^3.1.0", | ||
"jest": "^24.9.0", | ||
@@ -70,3 +70,3 @@ "lint-staged": "^9.4.3", | ||
"split2": "^3.1.1", | ||
"ts-jest": "^24.1.0", | ||
"ts-jest": "^24.2.0", | ||
"typescript": "^3.7.2" | ||
@@ -73,0 +73,0 @@ }, |
@@ -19,2 +19,3 @@ import { IncomingMessage } from 'http' | ||
export async function replayNormalizedWS(ws: WebSocket, req: IncomingMessage) { | ||
let messages: AsyncIterableIterator<any> | undefined | ||
try { | ||
@@ -44,3 +45,3 @@ const startTimestamp = new Date().getTime() | ||
const filterByDataType = constructDataTypeFilter(options) | ||
const messages = messagesIterables.length === 1 ? messagesIterables[0] : combine(...messagesIterables) | ||
messages = messagesIterables.length === 1 ? messagesIterables[0] : combine(...messagesIterables) | ||
@@ -60,2 +61,7 @@ // pipe replayed messages through transform stream that filters those if needed and stringifies and then finally trough WebSocket stream | ||
} catch (e) { | ||
// this will underlying open WS connections | ||
if (messages !== undefined) { | ||
messages!.return!() | ||
} | ||
ws.close(1011, e.toString()) | ||
@@ -62,0 +68,0 @@ debug('WebSocket /ws-replay-normalized error: %o', e) |
@@ -19,2 +19,4 @@ import { IncomingMessage } from 'http' | ||
export async function streamNormalizedWS(ws: WebSocket, req: IncomingMessage) { | ||
let messages: AsyncIterableIterator<any> | undefined | ||
try { | ||
@@ -44,3 +46,3 @@ const startTimestamp = new Date().getTime() | ||
const filterByDataType = constructDataTypeFilter(options) | ||
const messages = messagesIterables.length === 1 ? messagesIterables[0] : combine(...messagesIterables) | ||
messages = messagesIterables.length === 1 ? messagesIterables[0] : combine(...messagesIterables) | ||
@@ -60,2 +62,7 @@ // pipe streamed messages through transform stream that filters those if needed and stringifies and then finally trough WebSocket stream | ||
} catch (e) { | ||
// this will underlying open WS connections | ||
if (messages !== undefined) { | ||
messages!.return!() | ||
} | ||
ws.close(1011, e.toString()) | ||
@@ -62,0 +69,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
152771
2229
Updatedtardis-dev@^7.7.7
Updatedyargs@^14.2.2