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

JS Realtime SDK Presence Callback Never Executed #1832

Open
CameronSumpter opened this issue Aug 2, 2024 · 1 comment
Open

JS Realtime SDK Presence Callback Never Executed #1832

CameronSumpter opened this issue Aug 2, 2024 · 1 comment
Labels
documentation Improvements or additions to public interface documentation (API reference or readme).

Comments

@CameronSumpter
Copy link

CameronSumpter commented Aug 2, 2024

Using the JS Realtime SDK v2.3.0, it seems that the callback function is never executed; the Documentation indicates that it should be called on both success and failure.

Steps to Reproduce:

Given an existing channel which has already been subscribed to, this snippet establishes presence but does not generate console output when it should:
channel.presence.enter({}, function(err){ console.log(🎉); });

Changing the data payload to an invalid data type to force an error causes a Error: Data type is unsupported exception instead of executing the callback function, as in:
channel.presence.enter(0, function(err){ console.log(err); });

Workaround:

Chaining a promise works as expected, as in:

channel.presence.enter().then(
  function() { console.log('🎉'); },
  function(err) { console.log(err); }
);

┆Issue is synchronized with this Jira Task by Unito

@VeskeR
Copy link
Contributor

VeskeR commented Aug 2, 2024

Hi @CameronSumpter !

The callbacks API for all SDK's methods has been deprecated as part of the ably-js v2 release. All methods that previously used callbacks now support promises only, hence your code sample with using promises is an intended way to use the library in v2 (you can also use async/await).

Unfortunately the API References docs you linked were not updated accordingly yet. While we're working on updating them with the latest v2 changes, you can refer to auto-generated typedoc for ably-js, or use type information from the type declaration file provided by the library (should be picked up automatically by your editor to provide correct type information).

@VeskeR VeskeR added the documentation Improvements or additions to public interface documentation (API reference or readme). label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to public interface documentation (API reference or readme).
Development

No branches or pull requests

2 participants