I really want to 'push with priority'. But this doesn't exist, so I am planning on doing a push with out parameters, then a setWithPriority with the returned reference. Similar to the example in the docs.
var messageListRef = new Firebase('https://samplechat.firebaseio-demo.com/message_list');
var newMessageRef = messageListRef.push();
newMessageRef.set({ 'user_id': 'fred', 'text': 'Yabba Dabba Doo!' });
but more like
var messageListRef = new Firebase('https://samplechat.firebaseio-demo.com/message_list');
var newMessageRef = messageListRef.push();
newMessageRef.setWithPriority({ 'user_id': 'fred', 'text': 'Yabba Dabba Doo!' },1000);
What I can't find is what happens to validation, call backs on the empty push?
Does it try to create an empty node - firing the validation and call backs etc?
Or does it just return a reference that is (sort of) guaranteed to be unique of all other pushes to that parent? With the 'add child'/validation etc firing only on the 'set'?
Edit
Ok. Having had it confirmed that there is no server side interaction on an parameterless Push - my code now reads:
var ref = window.lastref.child("Offers").push();
ref.setWithPriority(spaceof.data, Firebase.ServerValue.TIMESTAMP,function (data) { $("body").prepend(data); }
The firebase timstamp successfully gives a serverside timestamp as a priority, I intend to use this priority for garbage collection - deleting old 'offers' that have been laying around.
To prevent clientside spoofing I'll be looking to add a validation/security rule that the priority of a new node has to be with in a few seconds of the actual serverside timestamp (if I get stuck, I'll be back!).