pladaria / reconnecting-websocket

Reconnecting WebSocket. For Web, React Native, cli (Node.js)
MIT License
1.22k stars 197 forks source link

Expose retriesCount ? #53

Closed wd closed 6 years ago

wd commented 6 years ago

Will you consider to expose retriesCount to user ? So that users can show this count somewhere.

pladaria commented 6 years ago

I'm working in a full rewrite of this library. I could expose the retriesCount but that count should be:

  1. total number of retries
  2. number of retries since last successful connection

I would use the second option

wd commented 6 years ago

I agree, or maybe you can add both. Thanks.

pladaria commented 6 years ago

Exposed retryCount in latest version. Thanks

wd commented 6 years ago
        this._uptimeTimeout = setTimeout(()=>this._acceptOpen(), minUptime);

Here https://github.com/pladaria/reconnecting-websocket/blob/master/dist/reconnecting-websocket-cjs.js#L307 should be used an arrow function, otherwise this in _acceptOpen will be undefined.

Cannot set property '_retryCount' of undefined
_acceptOpen    reconnecting-websocket-cjs.js:301:8<unknown>