Opened 11 years ago

Closed 11 years ago

#6815 closed enhancement (fixed)

dojox.rpc.OfflineRest

Reported by: kriszyp Owned by: bradneuberg
Priority: high Milestone: 1.2
Component: General Version: 1.1.0
Keywords: Rest offline Cc: Dustin Machi
Blocked By: Blocking:

Description

OfflineRest? is a module that adds local storage capability to the Rest service. When OfflineRest? is used, whenever resources are loaded with the Rest service, the results will be cached in local storage. In offline mode, the applications can then access the cached Rest results. When modification requests (PUT, POST, or DELETE) are made through the Rest service, the cache will be modified per the request. The request will also be stored in a list pending requests until the result is successfully delivered to the server. In offline mode, all the different REST methods are available, and all modification requests will not only modify the local storage cache, but they will be queued up for delivery to the server when network connectivity is restored.

The dojox.rpc.Rest is used by the JsonRestStore? which provides dojo data API for REST servers. The OfflineRest? module provides automatic offline capability for those using this store.

Right now dojox.rpc.OfflineRest? is only dependent on dojox.storage, it doesn not utilize anything in dojox.off. I built it this way to reduce dependencies; developers could use this with out without the full dojox.off libraries. OfflineRest? always stores modification requests locally in a list of pending requests until the request goes through. When requests fail, OfflineRest? request periodically retries until successfully. Therefore OfflineRest? does not need to be notified of offline status or use the action recording system.

However, I am not sure if this is really the best approach. Perhaps it would be better if OfflineRest? did utilize dojox.off notifications and hooks for better UI and syncing integration. I am not sure what is best here, so I am open to suggestions.

Also this is dependent on http://trac.dojotoolkit.org/ticket/6463.

Attachments (1)

OfflineRest.js (5.9 KB) - added by kriszyp 11 years ago.
dojox.rpc.OfflineRest?

Download all attachments as: .zip

Change History (6)

Changed 11 years ago by kriszyp

Attachment: OfflineRest.js added

dojox.rpc.OfflineRest?

comment:1 Changed 11 years ago by bradneuberg

Hi Kris! This looks cool. Do you know when 1.2 is timeframed to go out the door?

comment:2 Changed 11 years ago by dylan

Brad, sometime in July... ideally, we'd get this done in the next week or two.

comment:3 in reply to:  description Changed 11 years ago by guest

Looks awesome!!

I think support for dojox.off notifications and hooks can be a big plus because UI sync and notification are required for true offline usage.
Maybe an extension can add dojox.off support.

comment:4 Changed 11 years ago by kriszyp

guest: I have actually divided this module into dojox.rpc.LocalStorageRest? which does the local storage of REST requests in a write-back cache for auto-synchronization, and then dojox.rpc.OfflineRest? uses dojox.off and uses LocalStorageRest? for the sync. Consequently with dojox.rpc.OfflineRest? you can hook into the dojox.off notifications. I think I am actually ready to check this, but it is now dependent on http://trac.dojotoolkit.org/ticket/7030, which I use to update cached queries.

comment:5 Changed 11 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

(In [14268]) fixes #6815

Note: See TracTickets for help on using tickets.