"Offline" rails app?


#1

Hope this question doesn’t sound too strange. This is a typical
synchronization scenario, and I’ve done this a lot with .Net “rich
clients”, but I’m fairly new to web programming and to rails.

I’m developing browser-based applications that will sometimes have to be
disconnected from the internet. One example is a browser-based app for
conference registrations. At the hotel, I’d like to provide laptops
with my app hosted locally, since there may not be internet connections
available. I would use MySQL on the client, etc. so that to the rails
app, everything seems normal.

But when there is an internet connection, I would want to push to the
“master” database any new rows that have been added to certain tables,
and to pull down and updates that have been made to the master since
that client last connected.

MySQL only seems to support one-way replication, from slave (the client)
up to the master. So I’m thinking I need to write some code to perform
the synchronization myself.

My questions are:

  • is there any advice on a “canonical” way to switch the rails app from
    offline mode to online mode? Would SwitchTower be of any use here?
  • can anyone confirm/deny my fears that MySQL can’t do this for me
    automatically?
  • is there something really obvious that I’m missing here?

Thanks!
Jeff


#2

This could be done…

sqlite on the client…

deploy the app as an .exe (search for tutorial)…

add scheduled task on laptop so that it tries to sync with the master
every hours/whatever…

could be done…

Mikkel

Jeff C. wrote:

Hope this question doesn’t sound too strange. This is a typical
synchronization scenario, and I’ve done this a lot with .Net “rich
clients”, but I’m fairly new to web programming and to rails.

I’m developing browser-based applications that will sometimes have to be
disconnected from the internet. One example is a browser-based app for
conference registrations. At the hotel, I’d like to provide laptops
with my app hosted locally, since there may not be internet connections
available. I would use MySQL on the client, etc. so that to the rails
app, everything seems normal.

But when there is an internet connection, I would want to push to the
“master” database any new rows that have been added to certain tables,
and to pull down and updates that have been made to the master since
that client last connected.

MySQL only seems to support one-way replication, from slave (the client)
up to the master. So I’m thinking I need to write some code to perform
the synchronization myself.

My questions are:

  • is there any advice on a “canonical” way to switch the rails app from
    offline mode to online mode? Would SwitchTower be of any use here?
  • can anyone confirm/deny my fears that MySQL can’t do this for me
    automatically?
  • is there something really obvious that I’m missing here?

Thanks!
Jeff


#3

took the word right out of my mouth mikel, just one addition…

http://www.erikveen.dds.nl/distributingrubyapplications/rails.html


#4

I have the same requirements … so am I right to assume that I can do a
two-way replication/sync over the Internet using sqlite and mysql?

Or would the ‘synching’ bit have to be a manual implementation - using
say webservices or something? This is the approach I was about to embark
on.

Joerg


#5

Jeff C. wrote:

I’m developing browser-based applications that will sometimes have to be
disconnected from the internet. One example is a browser-based app for
conference registrations. At the hotel, I’d like to provide laptops
with my app hosted locally, since there may not be internet connections
available. I would use MySQL on the client, etc. so that to the rails
app, everything seems normal.

I vaguely remember seeing an entry about offline capabilities in a
roadmap for firefox 2.0. But now I can’t find it anymore.
I think it would be awesome if you could just open a web page from the
browser cache and use it’s forms for entering data. The data is saved
through a js interface to something like a cookie, that can be read by
the page on the next HTTP connection to the page.
On http://wiki.mozilla.org/Firefox:2.0_Product_Planning there is a
mention of “Supercookies”. Is it possible that this is something like
what I described?