TypeError: u.callback is undefined

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

balasourav
Posts: 12
Joined: 25 Jul 2017, 07:44

TypeError: u.callback is undefined

Postby balasourav » 01 Aug 2019, 06:55

Connector (npm+webpack variant)
------------------------------
URL - http://docs2x.smartfoxserver.com/Exampl ... pm-webpack

I use this url to Integrate sfs into my project. This is phaser gaming project.

1st i install api use this command "npm install sfs2x-api --save".

Then I don't use webpack alternately i use parcel bundler. So i don't know how to remove warning filter in parcel. So i skip warningfilter step
then i import the API like this->

"import * as SFS2X from "sfs2x-api";"

This is the following code to implement SFS connection

import * as SFS2X from "sfs2x-api";

let sfsConn = null;

export default class SfsCon
{
constructor()
{
if(this.sfsConn == null)
{
sfsConn = new SFS2X.SmartFox();

this.config =
{
host : '127.0.0.1',
port : 8080,
zone : 'BasicExample',
debug: true,
};

sfsConn = new SFS2X.SmartFox(this.config);
sfsConn.addEventListener(SFS2X.SFSEvent.CONNECTION, this.onConnection, this);

sfsConn.connect();
}
else
{
return sfsConn;
}
}

onConnection(event)
{
console.log(event);
if (event.success == true)
{
console.log("Connected to SmartFoxServer 2X!");
}
}

}


I got this Following error, Here i attach the error png's.
Attachments
error.png
(14.52 KiB) Not downloaded yet
Error1.png
(19.01 KiB) Not downloaded yet
User avatar
Lapo
Site Admin
Posts: 21065
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: TypeError: u.callback is undefined

Postby Lapo » 01 Aug 2019, 08:22

Hi,
quite a strange error. I will need my Javascript dev colleague to take a look as I don't think I've ever seen this before.
He'll be back from vacation next week. He'll get back to you as soon as possible.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
balasourav
Posts: 12
Joined: 25 Jul 2017, 07:44

Re: TypeError: u.callback is undefined

Postby balasourav » 01 Aug 2019, 10:26

Thanks for your reply @lapo... I need to add any "warningfilter" in parcel Bundler. Please inform your colleague to rectify this Problem ASAP.
User avatar
Bax
Site Admin
Posts: 4479
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: TypeError: u.callback is undefined

Postby Bax » 07 Aug 2019, 07:14

I'm not familiar with Parcel, so it is not clear what a "warningfilter" is. Can you better explain what issue are you experiencing? Thank you.

In the constructor you are checking this.sfsConn, which will always be null, because this.sfsConn is not sfsConn.
I suggest to review your code and test again.
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X HTML5 / JavaScript API”

Who is online

Users browsing this forum: No registered users and 1 guest