Bug 481413 - JavaScript offline buffering
Summary: JavaScript offline buffering
Status: ASSIGNED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Paho (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Mike Tran CLA
QA Contact: Ian Craggs CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-04 09:32 EST by Mike Tran CLA
Modified: 2016-02-05 11:15 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Tran CLA 2015-11-04 09:32:01 EST
Here is a couple of use cases (copied from email sent by Dennis Wulff)

1.      Mobile App publishes messages to back end
App Connects
App attempts to publish message (wants guaranteed delivery) and is no longer connected
App retries without success
Now what to do with this message
              Save it in JS object?
              Save in indexedDB?
              Drop and notify user?

Currently to guarantee delivery some custom coding is required to save and manage the message until reconnected. It would be ideal if MQTT lib handled storage and resend logic.


2.      App is deployed to field on laptop roaming in and out of wifi
Same as above
Comment 1 Ian Craggs CLA 2015-11-04 10:09:46 EST
Assigning to Mike.

Use cases:

1) Remember we are talking about browser apps only for this JavaScript client.  The client could give similar options to the Java or C clients for persistence - allow the app to choose what type of persistence to use: memory, disk, or an app supplied plugin.  Disk or similar is only needed if the app can terminate and then restart with those messages ready to send.   

Given that the current JavaScript application does not persist to anything other than memory, I suggest we do the same for the "offline buffering", for now.  That's what many client libraries do anyway.

2) This means the wifi connection is dropping and re-establishing.  While the app continues running, you don't need to store the messages in anything other than memory like the Paho Python client.
Comment 2 Mike Tran CLA 2015-11-04 10:28:55 EST
I think for JavaScript we can have a callback to allow the application to persist offline messages via HTML5 webStorage support   https://html.spec.whatwg.org/multipage/webstorage.html
Comment 3 Ian Craggs CLA 2015-11-04 10:34:05 EST
Yes, I was thinking that for HTML5, then using webstorage would be an option.  A callback would be an ideal solution.  

We would also have to add a callback for the persistence of inflight message state, which doesn't exist at the moment.
Comment 4 James Sutton CLA 2016-02-05 06:19:31 EST
Migrated to GitHub Issue: https://github.com/eclipse/paho.mqtt.javascript/issues/6