Closed black-hawk85 closed 3 years ago
Hey, this issue to be solved need development for create a new listener for connection troubles, but if you make a request it will reject if timeouted
keep open this issue
Hey,
yesterday while maintenance I tried making http request with axios.
var axios = require('axios')
axios.get("http://" + this.connector.account.host).then(res => {
console.log(res)
}).catch(e => {
console.log(e.response.status)
})
I always get status 403 no matter if system is online or offline.
There must be a solution from WebSocket side.
@black-hawk85 this API is only works through WebSocket
Ya I thought so. But I had the hope that their host will be down. Is there a possibility to ping the host through your WS connection before I start waiting for onReady?
@black-hawk85 for a fast solution I think you can just do a connection timeout, so if its not connected in 10 sec you can just handle it as the service is down, you can create function for it
@black-hawk85 I solved this issue by: now you can add timeout parameter to connection function
Hey, it's friday evening and xStation is closed due to maintenance, so the API is unreachable.
Just tried to get my balance via xapi-node but my Promise will never get resolved or rejected as connector.onReady or connector.onReject is never called. I would expect connector.onReject should be called in this case or do you have any other callback for this case?
I think you should be able to reproduce this by setting options.host to any unknown host.