Page 1 of 1

duplicate event fire

Posted: 06 Feb 2018, 11:21
by steve13627
Hi All,

There is a trange problem I was encount, the client receive twice same event . Is there any people face this issue before?

Re: duplicate event fire

Posted: 06 Feb 2018, 11:23
by steve13627
To solve this problem, I also add the user variable update event hanlder in server side, but it fires once, is there any thing wrong?

Re: duplicate event fire

Posted: 06 Feb 2018, 15:44
by Lapo
Hi,
can you please describe what event is being fired twice? And show the code that generates such event?

Is it possible you've added two listeners for the same event? Thus generating two calls?
Also, please specify the client API platform and version in use.

Thanks

Re: duplicate event fire

Posted: 07 Feb 2018, 03:45
by steve13627
Please refer the code as below:

Code: Select all

 UserVariable uv=new SFSUserVariable("cards", null);
 this.getApi().setUserVariables(user,Arrays.asList(uv),true,true);


after this code, I am trying to reset this variable like below:

Code: Select all

  SFSArray sfsarray = (SFSArray) existingCardList.getValue();
    existingCardList = SFSUserVariable.newInstance(VariableConfig.CARDS_VARIABLE, sfsarray);


    ArrayList<UserVariable> list = new ArrayList<UserVariable>();
    list.add(existingCardList);
    api.setUserVariables(user, list,true,isfireClient);


But it seems the client didn't receive the clear cmd but twice set cmd. That's the problem. The api which is using in client is version "1.7.0".The server side is "1.6.0". Now I am going to comment the first block code to make it works

Re: duplicate event fire

Posted: 07 Feb 2018, 09:47
by Lapo
If you're setting twice in your code, you will get two events. This is expected.