Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Event Handling in the Realm Object Server

Tim Oliver
December 08, 2016

Event Handling in the Realm Object Server

Presented at the Realm meetup on December 8, 2016, this presentation serves as an introduction to the new event handling features of the Realm Mobile Platform.

Tim Oliver

December 08, 2016
Tweet

More Decks by Tim Oliver

Other Decks in Technology

Transcript

  1. @TimOliverAU [email protected] • Cocoa Engineer at Realm • With the

    company since March 2015 • Main focus on utility and demo apps • From Perth in Western Australia • Former remote worker from Perth
  2. Overview [email protected] • Quick revisit of the Realm Mobile Platform

    • Introducing the concept of Event Handling • Demonstrating Event Handling
  3. [email protected] “I deleted the app and when I reinstalled it,

    all of my saved items were gone! How do I get them back!?!” - Former Customer
  4. [email protected] Native object JSON Backend object SQL Backend object JSON

    Native object SQLite/CoreData SQLite/CoreData The Traditional Way
  5. RMP Developer Edition [email protected] • Performs data synchronization between devices

    and server • It’s not possible to access user data on the server • Useful for maintaining consistent state across user devices • Not so useful for server-side processing / web services • (User devices could be used for processing/controlling events)
  6. Pro/Enterprise Editions [email protected] • Exposes read-write access to the user

    data on the server • Includes a special version of the Realm Node.js package • Can register callbacks for detecting when Realm data changes • Uses callbacks to respond to user-driven events • Third party services can then write data automatically
  7. [email protected] Handling user-driven events var SERVER_URL = 'realm://127.0.0.1:9080'; var NOTIFIER_PATH

    = ‘.*/myrealm’; var admin_user = Realm.Sync.User.adminUser(REALM_ADMIN_TOKEN); var change_notification_callback = function(change_event) { console.log(‘A change occurred!’); }; Realm.Sync.addListener(SERVER_URL, admin_user, NOTIFIER_PATH, ‘change', change_notification_callback);
  8. [email protected] Event-Handling Summary • Handled via Node.js to allow full

    Realm read-write access • Data can be shared with other backend services (eg MySQL) • Callbacks can be registered to respond to Realm data changes • All writes made from Node.js SDK automatically sync to devices
  9. [email protected] The TextScanner App • Take a photo of some

    text. • Save that photo data to Realm. • ROS receives data, forwards it to Google OCR via a JSON REST API. • Receives REST response from Google, decodes and saves results back to Realm. • Resulting scanned text is synchronized to device and displayed on screen.
  10. [email protected] The “Scanner” App • Take a photo of some

    text. • Save that photo data to Realm. • ROS receives data, forwards it to three Watson Image Recognition APIs • Asynchronously receives results from each API, and saves to same Realm object. • Changes to the Realm object are consolidated and sent back to app.
  11. We’re hiring [email protected] • iOS Evangelist • Android Evangelist •

    C++ Core • Javascript • Automation Engineer • C# Engineer • Product Manager • and much more! realm.io/jobs