Disconnect from Firebase after an initial read i.e. using it as a traditional and not a real-time data store -


i trying out firebase , have seen 1 of limits number of concurrent connections. in use case, don't need real-time anything- want able use firebase back-end data store. traditional web apps, ideally open connection firebase, grab data, disconnect firebase , free connections other users.

various answers here in have given me impression firebase makes difficult support kind of usage. see:

  1. how concurrent users determined firebase app?
  2. disconnecting firebase socket without refresh or closing page

two questions:

  1. is creation of new firebase reference via var ref = new firebase('<url>'); beginning of long-polling connection firebase?
  2. is there built-in support/api creating short-lived connection firebase being able disconnect after data retrieval, users idle on page without doing won't eat concurrent connection limit?

firebase lets use url rest endpoint instead of using javascript api.

there full tutorial on the firebase developers site. can use xhr (ajax) send , obtain content firebase other backend.

the javascript api powerful real time apps in case, if want stateless transfer, making ajax request restful api seems better call.

for example:

var xhr = new xmlhttprequest(); xhr.open("get", "https://samplechat.firebaseio-demo.com/users/jack/name.json",true); xhr.onload = function(){     alert("got data firebase backend: "+xhr.response); }; xhr.send(); 

this should work in browsers support cors since firebase sends right headers. can use angular's $http or jquery's $.ajax if want abstraction layer on native xhr.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -