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

Presence Channel Member Added / Member Removed on iOS. #2

Open
indigoswann opened this issue Nov 24, 2020 · 4 comments
Open

Presence Channel Member Added / Member Removed on iOS. #2

indigoswann opened this issue Nov 24, 2020 · 4 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@indigoswann
Copy link

indigoswann commented Nov 24, 2020

Steps to reproduce

  • Install example app, setup Pusher presence channel.
  • Connect to Pusher presence channel
  • Bind to pusher:member_added / pusher:member_removed

Expected behavior

Member data returned when these two pusher events are bound.

Actual behavior

No response on iOS. Pusher SDK recommends passing onMemberAdded and onMemberRemoved callbacks when the presence channel is bound on iOS.

Any improvements you suggest

No it's a good package overall. Member added / member removed works on Android, but I would suggest transforming the data to a JSON payload. It comes as a Java List string and is difficult to parse. Here is how I parsed it:

channel.bind('pusher:subscription_succeeded', (members) {
    if(Platform.isAndroid) {
        var users = [];
        String str = members.data.toString();
        String regexString = r'(?<=\{)(.*?)(?=\})';
        RegExp regExp = new RegExp(regexString);
        var matches = regExp.allMatches(str);
        matches.forEach((element) {
        String jsonString = "{"+element.group(0)+"}";
        var user = jsonDecode(jsonString);
        print(user.toString());
        });
    } else {
        // ... IOS payload works fine.
    }
});

...

@chinloyal chinloyal added bug Something isn't working good first issue Good for newcomers labels Nov 24, 2020
@chinloyal
Copy link
Owner

Thanks for using this package, I'll try to resolve this bug.

@chinloyal chinloyal added this to In progress in Pusher Client for Flutter Nov 24, 2020
@indigoswann
Copy link
Author

it is great package otherwise, thank you for providing it mate

@alexkok
Copy link

alexkok commented Mar 6, 2021

Faced the same issue. Solved the first part with #12 : the member_added and member_removed events that were not being triggered for iOS

@gouthamravella
Copy link

gouthamravella commented Mar 15, 2021

When can this will be resolved and released? And also, can we get members count too for presence channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
Status: In progress
Development

No branches or pull requests

4 participants