Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PusherClient#resetActivityCheck not actually disconnecting #10

Open
paulstraw opened this issue Dec 8, 2014 · 1 comment
Open

PusherClient#resetActivityCheck not actually disconnecting #10

paulstraw opened this issue Dec 8, 2014 · 1 comment

Comments

@paulstraw
Copy link

Hi there!

I'm using this library to communicate with Pusher from a Mac server. Unfortunately, when the server goes to sleep and is woken back up, the resetActivityCheck method calls its waitingTimeout. This wouldn't be a big deal, except the waitingTimeout doesn't actually seem to disconnect; it only unsubscribes from the connected channels. Here's the relevant code (from lib/pusher-node-client.coffee):

@waitingTimeout = setTimeout(
  () =>
    console.log "disconnecting because of inactivity at #{(new Date).toLocaleTimeString()}"
    _(@channels).each (channel) =>
        @unsubscribe channel.channel_name, channel.channel_data
    console.log "connetcing again at #{(new Date).toLocaleTimeString()}"
    if @connection.state isnt "open"
      @connect()
  30000
)

Is this intended behavior? If so, it would probably make sense to emit another event, so consumer code can know it should attempt to reconnect to any appropriate channels. If you'd like, I can make this change and submit a PR, or you can let me know if there's another solution you'd like implemented.

Thanks!
-paul

@brettg2
Copy link

brettg2 commented Sep 7, 2015

Hi,

I'm running into a similar issue. After a long connection to a Pusher feed, the channel will stop responding, but the state of the connection object remains "open" so the following connect statement never gets called:

if (_this.connection.state !== "open") {
    return _this.connect();
}

Also, nothing happens after this except the channels being unsubscribed. What paulstraw mentioned above would be great so I could reconnect to pusher and do other things as well.

Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants