Help get this topic noticed by sharing it on Twitter, Facebook, or email.

Beacon.activeClient.disconnect() doesn't work

Beacon.activeClient.disconnect() doesn't work for the FlashLongPoll client. It tries to call a function unembed() but that function doesn't seem to exist.

The following seems to work, though:


Beacon.FlashLongPoll.swfobject.removeSWF(Beacon.FlashLongPoll.containerId);
2 people have
this problem
+1
Reply
  • cgbystrom (Product Manager) August 10, 2010 13:08
    unembed() actually exists in the Flash object, it will internally disconnect the Flash SWF from the server. However, it didn't remove the SWF object itself from the DOM.

    That's been fixed now and I added the line you suggested to the client.
    You can use


    Beacon.disconnect();


    to disconnect the client from the server (regardless of transport method of course).

    It's live now on the same URL, try it out and let me know if it doesn't work.
    http://beaconpush.com/1/client.js
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly

  • Hi!

    I have the following set up (which I think is pretty straight forward):
    When user enters the page, I call Beacon.connect(), then beacon.listen on a particular channel. Before messages are being sent to a channel, the number of users in the channel is checked to make sure there is someone present.
    If I send message to a channel with zero listeners I will get a 'user offline' notification. This works fine, well, almost...
    When user comes to the page, then leaves, he seems to be still registered as listener for a few minutes after. I do call Beacon.disconnect() when user leaves the page, but it does not seem to effectively disconnect the user and users in channel does not return zero. I would really appreciate some advice in this respect. Should I somehow 'un-listen'/leave the channel before calling Beacon.disconnect() or is there something else?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly

  • cgbystrom (Product Manager) January 26, 2012 15:45
    The server will still see the user as online since the user may just be between page reloads (it's a feature). If you do like to force a logout of a user, see the REST API http://beaconpush.com/guide/rest-api/.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly

  • Thanks for replying. Ok, I suppose that makes sense, although I was sort of hoping that expressly calling disconnect() should actually disconnect user from service.

    Anyhow, I tried using force_user_logout (I'm using beaconpush.php class), which is supposed to do the trick, but again it doesn't. User is still registered as online and listening to his channel for some minutes. Any other suggestions?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly