slact / nchan.js

NPM package for the Javasript client for Nchan
Other
91 stars 25 forks source link

Longpolling fixes #11

Closed Xon closed 6 years ago

Xon commented 6 years ago

Currently with long polling calling stop() on the NchanSubscriber object from within the 'message' event does nothing because the longpolling transport will recreate the request and keeps going anyway.

Second, I've introduced infrastructure to support adding delay between polling attempts.

I'm currently groveling in the transport in my application code to setup the pollDelay setting. A better way to configure each transport is something I plan to look at later once I start using the other transport types.

Xon commented 6 years ago

@slact is that acceptable? Passing a negative into setTimeout should get clamped to 0 as a minimum. Well for anything more modern than IE8

slact commented 6 years ago

I would rather accept just the stop() fix without the pollDelay infrastructure -- that should be another separate PR, and it would need to be one that exposes the delay setting to the user.

Xon commented 6 years ago

I'll pull them apart since it is so small.

Xon commented 6 years ago

I'll send through a pull request once I figure out how to expose the pollDelay outside the transport