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

Why api msg send one time but pusher event got message twice #274

Open
hafiz013 opened this issue Jul 16, 2020 · 1 comment
Open

Why api msg send one time but pusher event got message twice #274

hafiz013 opened this issue Jul 16, 2020 · 1 comment
Labels

Comments

@hafiz013
Copy link

What is the issue?

Why api msg send one time but pusher event got message twice

Is it a crash report? Submit stack traces or anything that you think would help

no crash

Any improvements you suggest

remove redundant data push at the same time
debug_console_pusher
debug_log_android

sample code:
in Application
` pusherOptions = new PusherOptions().setCluster(cluster_pusher);

 push = new Pusher(key_pusher, pusherOptions);

 push.connect();`

in fragment activity
` if (AppControll.push.getConnection().getState().compareTo(ConnectionState.CONNECTING) == 0){
}
if (AppControll.push.getConnection().getState().compareTo(ConnectionState.CONNECTED) == 0){
}
if (AppControll.push.getConnection().getState().compareTo(ConnectionState.DISCONNECTING) == 0){
}
if (AppControll.push.getConnection().getState().compareTo(ConnectionState.DISCONNECTED) == 0){
AppControll.push.connect();
}
if (AppControll.push.getConnection().getState().compareTo(ConnectionState.RECONNECTING) == 0){
}

    if (AppControll.push.getChannel(Config.TOPIC_GLOBAL) == null){
        channel = AppControll.push.subscribe(Config.TOPIC_GLOBAL);
    }else{
        channel = AppControll.push.getChannel(Config.TOPIC_GLOBAL);
    }

    channel.bind(Config.PUSHER_EVENT, new SubscriptionEventListener() {
        @Override
        public void onEvent(PusherEvent event) {
            Log.i("Pusher", "Received event with data: " + event.getData());   <-- this received twice.
       }
   }

`

CC @pusher/mobile

@benw-pusher
Copy link

I am unable to replicate this issue. It could be possible that you have two connections/subscriptions on the client receiving the event. Does your activity get loaded more than once?
Perhaps you could log the socket ID alongside the event receipt log? This would help identify if multiple connections are being established.

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

No branches or pull requests

3 participants