

Show HN: Make your app handle going offline - afschwartz
http://github.hubspot.com/offline/docs/welcome/

======
WA
> It captures AJAX requests which were made while the connection was down, and
> remakes them when it's back up, so your app reacts perfectly.

Is this something I want as a user? If an app seems to be offline, I tend to
do various things just to check or re-establish connectivity. Say, hit the
Send button a few times, order columns, filter, search, whatever. Stuff, I
wouldn't do if I had connection.

Once the app reconnects, all this nonsense would be executed. I'm not so sure
if I'd really want this as a user.

This leads to the question: How fast does it notice that the app went offline?
Do I get the chance to do stupid things as a user or will I be shown the
"you're offline" message soon enough?

~~~
zackbloom
After the first request fails it will confirm it's the connection at fault,
and immediately show the message. Depending on the nature of the connection
problem this can be immediate, but there is a small possibility that it can be
delayed if the nature of the problem causes connections to timeout. If we get
reports of that happening in the wild, there are things we might be able to
do.

------
ssafejava
You guys have put out some great pieces of JS in the last year and the quality
is getting better. I'm a big fan of how this is not jQuery dependent and the
code is simple. I've been watching the HubSpot repos since globalMessenger and
the code and presentation are far above par.

Thanks for releasing your internal libs.

------
pothibo
I think this is a neat proof of concept. However, you have to be extremely
careful to not get out of sync hell.

I see an enormous load of extra complexities for what seems to be very little
advantage.

On the other hand, if you list all the queued non-GET AJAX call for the user
to resend manually, it could be good.

I'm ambivalent :(

~~~
rmrfrmrf
Why are you critiquing this script like it's a consumer product? Obviously any
developer who wishes to use this will have do some extra work to make sure
things run smoothly.

~~~
pothibo
Maybe because I've already implemented something like this in the past and I
faced a lot of issues with synchronizing multiple states on multiple devices?

And I didn't say the library was bad, quite the contrary.

------
drsim
Kudos to hubspot: they're pushing out some nice js pieces from their app

------
Renaud
This comes at the perfect moment for me: I'm building an inventory web app
used in warehouses on tablets and I'm faced with connectivity issues
(incomplete or fluctuating WiFi coverage for instance).

Making the app less prone to these issues is certainly going to help build
something more robust, so thanks a lot!

~~~
jchrisa
We built Couchbase Lite as a serious embedded database for use cases like
this. Our PhoneGap connector might be right up your alley.
[http://mobile.couchbase.com](http://mobile.couchbase.com)

------
arvidkahl
The more I look into HubSpot libraries, the more I am amazed by their
approach. To the point, small and flexible. And if the only annoyance people
can bring up is a snake game, then you should be proud :)

Regarding this particular module: is there any chance of combining this with a
websocket connection (particularly socket.io)? I don't really care much for
off-site requests, but notifiying the user of a disconnected socket would play
well into this.

~~~
zackbloom
Thanks! Do you mind opening an issue for the websocket support in GitHub
Issues? I'm not sure if there's anything we can do there, but I'm happy to
talk about it.

------
contrahax
Why is there a snake game wasting space in the source code?

~~~
zackbloom
Just my own amusement, I'll make you a build without it.

Edit: It's no longer included in the minified build

------
smcl
This is actually a very cool idea, but I'm gonna raise a minor nitpick which
has been growing inside me over the last few months:

> It has a number of beautiful themes and requires no configuration

"Beautiful" is a word that's really getting overused nowadays, and I cringe
whenever I see it.

Edit: I anticipated the downvoting

~~~
zackbloom
I wrote the copy, which word would you prefer?

~~~
GrinningFool
Could just go with "a number of themes".

------
NARKOZ
How do you decide when to put `#hubspot-open-source` hashtag to repo
description?

~~~
zackbloom
It's actually used to control what projects show up here:
[http://github.hubspot.com/](http://github.hubspot.com/)

------
alinawab
This is a really useful starting point, thanks for sharing

------
antihero
This looks neat, has anyone tried it with AngularJS?

------
while1
Cool! This looks really nice and definitely useful!

------
sifarat
can anyone explain how to set options like i want to disable requests and set
it to false. appreciate.

------
uaygsfdbzf
This is just what i need!! For my html5,json,localstorage app. But what if the
user press Reload ? But what if the browser crasher or closed normally, does
the buffer stay ? if not then it's useless!

