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

PusherEvent push data in fragment twice #272

Open
hafiz013 opened this issue Jul 9, 2020 · 2 comments
Open

PusherEvent push data in fragment twice #272

hafiz013 opened this issue Jul 9, 2020 · 2 comments
Labels

Comments

@hafiz013
Copy link

hafiz013 commented Jul 9, 2020

Below here my code inside fragment:

`options = new PusherOptions();
options.setCluster(cluster_pusher);

    pusher = new Pusher(key_pusher, options);

    pusher.connect(new ConnectionEventListener() {
        @Override
        public void onConnectionStateChange(ConnectionStateChange change) {
            Log.i("Pusher", "State changed from " + change.getPreviousState() +
                    " to " + change.getCurrentState());
        }

        @Override
        public void onError(String message, String code, Exception e) {
            Log.i("Pusher", "There was a problem connecting! " +
                    "\ncode: " + code +
                    "\nmessage: " + message +
                    "\nException: " + e
            );
        }
    }, ConnectionState.ALL);

    channel = pusher.subscribe(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());

}
});`

why?

@daniellevass
Copy link
Contributor

Hi,

Can you please explain what's happening and what you expected to happen in more detail? This appears to be the same code snippet we provide in the readme and should write to the logcat for every message received.

Thank you,

@hafiz013
Copy link
Author

hafiz013 commented Jul 9, 2020

expected data receive from event.getData():

  1. one time only {"type":"LiveBid","server_time":"2020-07-09 17:17:38","time_expire":"17:19:38","bid":"28","title":"Test PINENG PN-939 20000mAh 3 Input Lithium Polymer Power Bank - Black / White","current_price":"21.25","bidder_name":"hafiz_test","bid_status":"Active"}

but i received twice:
{"type":"LiveBid","server_time":"2020-07-09 17:17:38","time_expire":"17:19:38","bid":"28","title":"Test PINENG PN-939 20000mAh 3 Input Lithium Polymer Power Bank - Black / White","current_price":"21.25","bidder_name":"hafiz_test","bid_status":"Active"}
{"type":"LiveBid","server_time":"2020-07-09 17:17:38","time_expire":"17:19:38","bid":"28","title":"Test PINENG PN-939 20000mAh 3 Input Lithium Polymer Power Bank - Black / White","current_price":"21.25","bidder_name":"hafiz_test","bid_status":"Active"}

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