Page 1 of 1

Migration guide from api-js 1.2.0 to 1.7.17

Posted: 25 Feb 2021, 16:37
by midaV
Can I find somewhere a migration guide to update the library on the frontend from version 1.2.0 to 1.7.17?
I try just to update lib to new version but there are so many changes... I spent the whole day making changes, but I'm still not done. :(

Re: Migration guide from api-js 1.2.0 to 1.7.17

Posted: 26 Feb 2021, 16:37
by Lapo
Hi,
no we don't have such guide. The two API are indeed pretty different as the original JSON-based API was a simplified version of the API we have for other languages such as C#, Java, Objective-C etc.

I think the best approach is to rewrite the application starting from the original code and rebuilding it using the new API, via the reference docs and examples.
http://docs2x.smartfoxserver.com/api-docs/jsdoc/client/
https://www.smartfoxserver.com/download#p=examples

If there's any question regarding the API let us know

Re: Migration guide from api-js 1.2.0 to 1.7.17

Posted: 01 Mar 2021, 10:01
by midaV
Unfortunately, the application I'm developing is not so easy to rewrite...
Thank you for your reply.

Re: Migration guide from api-js 1.2.0 to 1.7.17

Posted: 01 Mar 2021, 14:04
by Lapo
I don't think this should affect the logic of your application that much. The legacy Javascript API and the new JS API differ mainly in how data is transported between client and server, using different objects to carry such data.

In the old API it was done through native JS data structures, in the new API it is done via the SFSObject/SFSArray classes. Other than that the API work pretty much in the same way. You still add custom event listeners for server events and send requests in the same way.

Cheers