BuddyList InitBuddyListRequest JavaScript error

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

raghavlyon
Posts: 2
Joined: 14 Jan 2014, 14:24

BuddyList InitBuddyListRequest JavaScript error

Postby raghavlyon » 14 Jan 2014, 14:47

I have searched almost every place where I could find the reference to my problem but I didn't find any resolution.
It is almost a week and I am stuck due to the buddy list error.

I am using buddy list html example which is provided by Smartfoxserver.
It works as expected in my local environment.

During integration to my own solution where I have custom login to verify user and after login user joins a room.
In the specific page I have a button "Chat", onclick of it I am sending a request to server for InitBuddyListRequest.

Code: Select all

       // Initialize the Buddy List system
   sfs.send(new SFS2X.Requests.BuddyList.InitBuddyListRequest());


I don't get any reply from server (at least I don't see) and on server console I don't have any error.
But when I did debug I received an error in JavaScript console, which is from the response of server.

Code: Select all

Uncaught TypeError: Object function (v) {
    for (var i = 0; i < this.length; i++) {
        if (this[i] === v)
            return true;
    }
    return false;
} has no method 'isNull'


This says it is at line number 180 of SFS2X_API_JS.js

I can't debug this since it is complied JavaScript provided by Smartfoxserver.

My zone configuration for the budddy list is below and I hope someone can help me out.

Code: Select all

  <buddyList active="true">
    <allowOfflineBuddyVariables>true</allowOfflineBuddyVariables>
    <maxItemsPerList>100</maxItemsPerList>
    <maxBuddyVariables>15</maxBuddyVariables>
    <offlineBuddyVariablesCacheSize>500</offlineBuddyVariablesCacheSize>
    <customStorageClass></customStorageClass>
    <useTempBuddies>true</useTempBuddies>
    <buddyStates>
      <string>Available</string>
      <string>Away</string>
      <string>Occupied</string>
    </buddyStates>
    <badWordsFilter isActive="true"/>
  </buddyList>

If there any further information required please let me know. Any help is very much appreciated.

Thanks in advance.
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: BuddyList InitBuddyListRequest JavaScript error

Postby Bax » 15 Jan 2014, 10:48

When initializing the Buddy List, the SFS2X.SFSBuddyEvent.BUDDY_LIST_INIT event should be fired if the initialization is successful, otherwise the SFS2X.SFSBuddyEvent.BUDDY_ERROR event should be fired.
If you are not receiving those events (did you register for them?) there's a chance that you are not even sending the request to the server. Can you double check?
Paolo Bax
The SmartFoxServer Team
raghavlyon
Posts: 2
Joined: 14 Jan 2014, 14:24

Re: BuddyList InitBuddyListRequest JavaScript error

Postby raghavlyon » 15 Jan 2014, 13:31

Hello Bax,

Thank you for the reply and I checked that server is receiving a request and I do believe it is sending a reply back to JS client and that's where I do get JS error in SFS2X_API_JS.js before my registered events triggered.
This I manage to verify when I send the init request after I received JS error.

Code: Select all

sfs.send(new SFS2X.Requests.BuddyList.InitBuddyListRequest());


and on server I have error this time.

Code: Select all

20:51:09,473 WARN  [com.smartfoxserver.v2.controllers.SystemController-1] controllers.SystemController     - java.lang.IllegalStateException: BuddyProperties already inited.
        com.smartfoxserver.v2.buddylist.SFSBuddyProperties.setInited(SFSBuddyProperties.java:28)
        com.smartfoxserver.v2.api.SFSBuddyApi.initBuddyList(SFSBuddyApi.java:80)
        com.smartfoxserver.v2.controllers.system.buddylist.InitBuddyList.execute(InitBuddyList.java:32)
        com.smartfoxserver.v2.controllers.SystemController.processRequest(SystemController.java:130)
        com.smartfoxserver.bitswarm.controllers.AbstractController.run(AbstractController.java:96)
        java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        java.lang.Thread.run(Unknown Source)


I wonder if any specific configuration to be done when custom login is used.
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: BuddyList InitBuddyListRequest JavaScript error

Postby Bax » 15 Jan 2014, 14:27

There's no correlation between the custom login and the buddy list system. In fact if you disable the custom login you should get the same behavior. Maybe you can check by yourself.
Are you able to provide a stripped down example showing the issue? So we can test it locally.
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X HTML5 / JavaScript API”

Who is online

Users browsing this forum: No registered users and 11 guests