simpleddp
simpleddp copied to clipboard
Connecting to non-existent / listening endpoint
As the title states,
how to deal when trying to connect to a non-answering endpoint? the connect promise will never resolve no disconnect or error gets fired?
Hello, by default - yes. But you can use maxTimeout
option (in ms)(https://gregivy.github.io/simpleddp/simpleDDP.html) like this:
let opts = {
endpoint: "ws://someserver.com/websocket",
SocketConstructor: ws,
reconnectInterval: 5000,
maxTimeout: 15000
};
const server = new simpleDDP(opts);
Hello Gregivy, I'm having similar issue, I think we need a graceful way to handle that error, settings the maxTimeout doesn't throw an error.
The maxtTimeout does trigger on method calls so it does the trick.
Thanks @Gregivy for this great library.
Thank you @aliogaili, however I am going to add maxTimeout
for .connect()
method, it is a good idea.