Skip to content

Commit ac14b43

Browse files
committed
Added Server Variables information
1 parent cf17b38 commit ac14b43

File tree

5 files changed

+36
-5
lines changed

5 files changed

+36
-5
lines changed

database/README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,4 +382,35 @@ The `localId` can be obtained after a successful `Sign In`, `Sign Up` or `Get Ac
382382

383383
The `auth` value can be obtained after a successful `Refresh Token` request.
384384

385-
For more information on these values you can read the [Firebase Auth guide](./../auth/).
385+
For more information on these values you can read the [Firebase Auth guide](./../auth/).
386+
387+
## Firebase Server Variables
388+
389+
Firebase allows you to use server variables for your fields. At the moment of this writing Firebase only offers a `timestamp` variable.
390+
391+
To use a server variable you need to create a property on your payload with the following signature: `{".sv": "variable_type"}`.
392+
393+
In the following example we are using the `timestamp` variable so our message will use a Firebase timestamp instead of a local one from the user's device.
394+
395+
```actionscript
396+
private function sendMessage(message:String, username:String):void
397+
{
398+
var myObject:Object = new Object();
399+
myObject.message = message;
400+
myObject.username = username;
401+
myObject.timestamp = {".sv": "timestamp"};
402+
403+
var request:URLRequest = new URLRequest("https://<YOUR-PROJECT-ID>.firebaseio.com/messages.json");
404+
request.method = URLRequestMethod.POST;
405+
request.data = JSON.stringify(myObject);
406+
407+
var loader:URLLoader = new URLLoader();
408+
loader.addEventListener(Event.COMPLETE, messageSent);
409+
loader.load(request);
410+
}
411+
412+
private function messageSent(event:Event):void
413+
{
414+
trace(event.currentTarget.data);
415+
}
416+
```
File renamed without changes.
File renamed without changes.

examples/FileManager.mxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
{
217217
PopUpManager.removePopUp(alert);
218218
219-
//The file has been successfully uploaded, we now createa a reference of it into the Database
219+
//The file has been successfully uploaded, we now create a reference of it into the Database
220220
var rawData:Object = JSON.parse(event.currentTarget.data);
221221
var myObject:Object = new Object();
222222
@@ -246,7 +246,7 @@
246246
}
247247
248248
/*
249-
Download Image Blcok
249+
Download Image Block
250250
*/
251251
private function downloadImage():void
252252
{

examples/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ service firebase.storage {
8989
}
9090
```
9191

92-
## EmailLoginExample.mxml
92+
## EmailLogin.mxml
9393

9494
An Apache Flex example that demonstrates how to perform most operations from the Email Auth service.
9595

9696
You will only require to provide your Firebase API Key and enable the `Email & Password` auth provider.
9797

98-
## FederatedLoginExample.mxml
98+
## FederatedLogin.mxml
9999

100100
An Apache Flex example that demonstrates how to perform log-in using Google, Twitter and Facebook providers within the same app.
101101

0 commit comments

Comments
 (0)