jsv3We are happy to announce that the newest versions of our JavaScript client SDKs are now officially GA!

Version 3 is a massive upgrade to our SDKs. It includes a full rewrite of our JavaScript codebase, along with several key architectural and functional improvements. We encourage developers to go to our Dev Center to go through the details and try out the new SDKs. A few highlights of the new version are discussed below.

We’ve made caching and offline support integral to our SDK

In our experience, apps built on Kinvey’s backend as a service manage data in one of three broad patterns –

  1. Predominantly offline – these apps are often used in the field for long durations without a network connection. Periodically, the user connects to a network and synchronizes data between the device and the backend. Such usage is typical for field service apps.
  2. Offline-online – these apps are usually online and prefer getting data from the backend whenever possible. However, they need to be highly responsive in poor network conditions and support data access during short periods of offline use. A majority of popular apps fall in this category.
  3. Online only – occasionally an app requires that no data be stored on the device. This could be due to security or compliance restrictions, or during a testing and debugging phase.

With v3, we’ve designed our data stores in a way that makes it easy for developers to support each of these use cases. All you need to do is specify a “type” when a data store is created – that’s it! The library takes care of configuring read and write policies, creating and managing a cache, keeping track of offline write operations, and optimizing data transfers between the device and the backend. Basically, everything you need to write highly performant, responsive apps. We do most of the heavy lifting with data, so you can focus on building a slick user experience.

We’ve built it for high performance

We have learned a lot from Kinvey customers who have put our SDKs through various demanding performance problems. For example, one of our backend as a service customers recently built an app for field service professionals who often spend days, even weeks on the road with poor or no network connection. The amount of data generated on the device and synchronized with the backend in one go is in the order of tens of thousands of entities per user. This presented several challenges to our PhoneGap SDK.

Working with this customer, and with others who’ve had similar requirements, has led to many improvements in how our SDKs handle large volumes of data. We feel there’s a lot more we can do to improve the performance even further, but a few features in V3 are worth calling out:

Delta set caching

The library implements a mechanism to optimize the amount of data retrieved from the backend. When you use a Sync or Cache datastore, data requests to the backend only fetch data that changed since the previous update. We call this mechanism “Delta Set Caching.”

Sync optimizations

We’ve made it easier for apps to synchronize hundreds to thousands of offline write operations from the device to the backend. We’ve made our storage of offline data more efficient, added optimizations to local database operations, and implemented batching on network requests to send data faster to the backend. When you call “dataStore.push()” or “dataStore.sync()” from the app, all of these improvements are being used behind the scenes to improve the end-to-end response time. Learn more in our Dev Center.

Resumable File Uploads

The JavaScript v3 SDKs now support resumable file uploads with Google Cloud Storage. The SDK will try to upload as much of a file as possible, and handle interruptions seamlessly by resuming where it left off. We think this feature will go a long way towards supporting apps that require large files to be created and uploaded from the device.

We’ve focused on simplicity and consistency

When we built v3, we incorporated a lot of feedback from Kinvey developers and tried to make some of the complex things easier. Some of the key areas we focused on include:

  • Simple APIs to solve common problems
    • All caching and offline policies can be configured with a single setting; and data synchronization is supported with three basic APIs – “push()”, “pull()” and “sync()”.
    • Initializing the library, registering for push notifications, and similar setup actions are supported with synchronous, single line of code APIs.
  • APIs that follow platform best practices
    • We use RxJS observables so apps can observe data retrievals from the cache and the backend.
    • Apps can write queries in native JS syntax and have them executed offline as well as against backend data.
  • Consistent APIs across platforms
    • Developers who wish to switch between platforms (i.e from JavaScript to native iOS to native Android) can expect similar APIs across all of the Kinvey SDKs. This is in keeping with our principle of providing open and consistent interfaces, independent of the client platform or framework.

Finally…

Our JS SDKs are organized as a set of platform “shims” that all use a common core package. All of our shims have been under an open source license for a while now.

With v3, we are opening our JavaScript core SDK under the Apache 2.0 license. With this, all of our JavaScript SDKs (PhoneGap, Angular, HTML5, Titanium, and Node) are now completely open source!

We encourage Kinvey developers to help us improve the SDK. Check out the JS core and let us know what you think!