stomp-js / stompjs

Javascript and Typescript Stomp client for Web browsers and node.js apps
Apache License 2.0
776 stars 81 forks source link

connectionTimeout not work #638

Open shadowmas opened 2 months ago

shadowmas commented 2 months ago

After the WebSocket service stops, I want to stop reconnecting after a certain period of time.

I found connectionTimeout, but I noticed that connectionTimeout is not effective.

I found that at line 440 in client.ts, this.forceDisconnect() is called.

this.forceDisconnect();

However, in onWebSocketClose (line 486 in client.ts)

 this._stompHandler = undefined; // a new one will be created in case of a reconnect

This causes this.forceDisconnect() to not achieve the desired effect.

Version 7.0.0

mikadev commented 1 week ago

You should try reconnectDelay: 5000,