Page 1 of 1

TypeError: u.callback is undefined

Posted: 01 Aug 2019, 06:55
by balasourav
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.

Re: TypeError: u.callback is undefined

Posted: 01 Aug 2019, 08:22
by Lapo
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

Re: TypeError: u.callback is undefined

Posted: 01 Aug 2019, 10:26
by balasourav
Thanks for your reply @lapo... I need to add any "warningfilter" in parcel Bundler. Please inform your colleague to rectify this Problem ASAP.

Re: TypeError: u.callback is undefined

Posted: 07 Aug 2019, 07:14
by Bax
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.