[NEW] API v1.7.17 released

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

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

[NEW] API v1.7.17 released

Postby Bax » 23 Mar 2020, 11:29

We just released v1.7.17 of the SFS2X JavaScript client API.

In this release we fixed an issue with JavaScript's Strict Mode and a bunch of issue in our experimental TypeScript declarations file.

You can find the new version on the download page as usual: https://www.smartfoxserver.com/download/sfs2x#p=client
Paolo Bax
The SmartFoxServer Team
developer.kus
Posts: 10
Joined: 04 Jul 2018, 09:52

Re: [NEW] API v1.7.17 released

Postby developer.kus » 09 Jul 2021, 07:54

Dear,
Can I download javascript client version which's not minify(it's similar with JS-client 1.6), because when I develop witch Cocosjs native, it can't compile new client 1.7.8.
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: [NEW] API v1.7.17 released

Postby Bax » 09 Jul 2021, 08:36

The problem is that we are not minifying the JavaScript API...
We use Webpack to bundle the API in a single file and transpile the code from ES6 to ES5. We have no control over what's happening under the hood. I'm sorry.
Paolo Bax
The SmartFoxServer Team
developer.kus
Posts: 10
Joined: 04 Jul 2018, 09:52

Re: [NEW] API v1.7.17 released

Postby developer.kus » 09 Jul 2021, 09:02

Thank you,
I have another question: can I use older JS-client version(before release v1.7.0) with new server 2.17(with disable binary protocol). I'm not clearly with you doc(http://docs2x.smartfoxserver.com/Gettin ... ration-213)
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: [NEW] API v1.7.17 released

Postby Bax » 09 Jul 2021, 09:05

developer.kus wrote:Dear,
Can I download javascript client version which's not minify(it's similar with JS-client 1.6), because when I develop witch Cocosjs native, it can't compile new client 1.7.8.

Actually we are not sure why your CocosJS can't compile. In fact our SpaceWar example was created with CocosJS (version 3.13 I believe) and it uses our API v1.7.11. The game could be compiled without issues, so I'd expect it to work even if you use a later version of CocosJS.

We were also thinking of providing you the API source code, but it looks like CocosJS is not full compatible with ES6, while it is compatible with ES5 transpilation. https://stackoverflow.com/questions/399 ... cocos2d-js (second answer)
Paolo Bax
The SmartFoxServer Team
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: [NEW] API v1.7.17 released

Postby Bax » 09 Jul 2021, 09:07

developer.kus wrote:Thank you,
I have another question: can I use older JS-client version(before release v1.7.0) with new server 2.17(with disable binary protocol). I'm not clearly with you doc(http://docs2x.smartfoxserver.com/Gettin ... ration-213)

No sorry. That page refers to the old SFS v2.13. Non-binary protocol in JavaScript is not supported anymore.
Paolo Bax
The SmartFoxServer Team
developer.kus
Posts: 10
Joined: 04 Jul 2018, 09:52

Re: [NEW] API v1.7.17 released

Postby developer.kus » 09 Jul 2021, 09:32

Thank you,
I will download your SpaceWar example and research it.
developer.kus
Posts: 10
Joined: 04 Jul 2018, 09:52

Re: [NEW] API v1.7.17 released

Postby developer.kus » 09 Jul 2021, 10:39

I just upgrade my client code to 1.7.18 & server to 2.17, I have compiled all extension with new lib from server 2.17 & run without error in smart.log.
When I run login as code below I always get error Plugins/sfs2x-api-1.7.18.js:6:Error: LoginRequest Error.
and on SmartfoxServer only show

Code: Select all

09 Jul 2021 | 17:34:07,429 | INFO  | http-nio-8081-exec-3 | bitswarm.sessions.DefaultSessionManager |     | Session created: { Id: 6, Type: WEBSOCKET, Logged: No, IP: 14.177.13.75 } on Server port: 8081 <---> 56352


How can I see clearly error?


Code: Select all


var GameClient = cc.Class.extend({
    _callback : null,
    _publicRoom : null,
    _inGame : false,
    _canChatPublic: false,
    _gameRoom:{},
    _connectServer:false,
    _isPlayNow:false,
    ctor: function () {
        this._tcpClient = null;
        var config = {};
        config.host = Config.SERVER_LIVE;
        config.port = Config.PORT_LIVE;
        config.zone = Config.ZONE_LIVE;
        Global.log("Smartfox initial: config == " + JSON.stringify(config));
        //
        this._tcpClient = new SFS2X.SmartFox(config);
        this._tcpClient.logger.level = SFS2X.LogLevel.DEBUG;
        this._tcpClient.logger.enableConsoleOutput = true;
        // =====
        this._tcpClient.addEventListener(SFS2X.SFSEvent.CONNECTION, this.onConnection, this);
        this._tcpClient.addEventListener(SFS2X.SFSEvent.CONNECTION_LOST, this.onConnectionLost, this);
        this._tcpClient.addEventListener(SFS2X.SFSEvent.LOGIN_ERROR, this.onLoginError, this);
        this._tcpClient.addEventListener(SFS2X.SFSEvent.LOGIN, this.onLogin, this);
        this._tcpClient.addEventListener(SFS2X.SFSEvent.PING_PONG, this.onPingPong, this);
    },
    login : function (type) {
        Global.log("__loginByUser >> connectServer == " + this._connectServer);
        this.showLoading();
        // login to server
            var params = {};
            params.facebookId = Global.fb_uuid;
            params.verId      = Constant.VER_ID;
            var isSent = this._tcpClient.send(new SFS2X.LoginRequest(uuid, "123", params, this._tcpClient.config.zone));
            if (isSent) {
                Global.log('____loginByUser >> send login success == ');
            } else this.showOKDialog(this.getMessage('_NONETWORK_'));
     }
 
       


I work with cocos-js 3.17.2, build to native app. All code work well with client 1.6 & server 2.11(now I need upgrade to newest version).

Thank you very much
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: [NEW] API v1.7.17 released

Postby Bax » 09 Jul 2021, 10:57

It looks like there's an error in the parameters passed to the LoginRequest constructor.
I guess the problem is the params object, which is supposed to be a SFSObject instance.
Paolo Bax
The SmartFoxServer Team
developer.kus
Posts: 10
Joined: 04 Jul 2018, 09:52

Re: [NEW] API v1.7.17 released

Postby developer.kus » 09 Jul 2021, 11:52

yes, you're right. Smartfox new version change too much make me feel crazy :D .

Thank you very much.

Return to “SFS2X HTML5 / JavaScript API”

Who is online

Users browsing this forum: No registered users and 24 guests