Skip to content

Commit b59cbf6

Browse files
Merge branch 'master' into master
2 parents 1e4197e + 78affc4 commit b59cbf6

File tree

2 files changed

+47
-3
lines changed

2 files changed

+47
-3
lines changed

package.json

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xapi-node",
3-
"version": "2.5.5",
3+
"version": "2.5.6",
44
"description": "This project makes it possible to get data from Forex market, execute market or limit order with NodeJS/JS through WebSocket connection",
55
"exports": {
66
".": {
@@ -58,4 +58,48 @@
5858
"url": "https://github.com/peterszombati/xapi-node/issues"
5959
},
6060
"homepage": "https://github.com/peterszombati/xapi-node#readme"
61+
=======
62+
"name": "xapi-node",
63+
"version": "2.5.6",
64+
"description": "This project is made possible to get data from Forex market, execute market or limit order with NodeJS/JS through WebSocket connection",
65+
"main": "build/index.js",
66+
"types": "build/index.d.ts",
67+
"dependencies": {
68+
"logger4": "^2.1.5",
69+
"ws": "^7.2.3"
70+
},
71+
"devDependencies": {
72+
"@types/node": "^11.15.3",
73+
"typescript": "^3.4.5",
74+
"ts-mocha": "^8.0.0",
75+
"@types/chai": "^4.2.14",
76+
"@types/mocha": "^8.0.3",
77+
"chai": "^4.2.0",
78+
"mocha": "^8.2.0",
79+
"ts-node": "^9.0.0"
80+
},
81+
"scripts": {
82+
"test": "echo \"Error: no test specified\" && exit 1",
83+
"build": "tsc"
84+
},
85+
"repository": {
86+
"type": "git",
87+
"url": "git+https://github.com/peterszombati/xapi-node.git"
88+
},
89+
"keywords": [
90+
"xstation5",
91+
"trading",
92+
"xtb",
93+
"bfbcapital",
94+
"forex",
95+
"trading-api",
96+
"xopenhub"
97+
],
98+
"prepare": "npm run build",
99+
"author": "Peter Szombati",
100+
"license": "BSD 4-Clause",
101+
"bugs": {
102+
"url": "https://github.com/peterszombati/xapi-node/issues"
103+
},
104+
"homepage": "https://github.com/peterszombati/xapi-node#readme"
61105
}

src/core/Socket/SocketConnection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ export class SocketConnection extends Queue {
179179
JSON.stringify(e)
180180
)
181181

182-
if (retries > 0 && e.reason.code !== errorCode.XAPINODE_1 && e.reason.code !== errorCode.BE005) {
182+
if (retries > 0 && (!e.reason || (e.reason.code !== errorCode.XAPINODE_1 && e.reason.code !== errorCode.BE005))) {
183183
this.loginTimeout.setTimeout(() => {
184184
this.XAPI.logger.print('debug', `${new Date().toISOString()}: Try to login (retries = ${retries})`)
185185
this.tryLogin(retries - 1)
186186
}, 500)
187-
} else if (e.reason.code === errorCode.BE005) {
187+
} else if (e.reason && e.reason.code === errorCode.BE005) {
188188
this.XAPI.logger.print(
189189
'debug',
190190
`${new Date().toISOString()}: Disconnect from stream and socket (reason = 'login error code is ${

0 commit comments

Comments
 (0)