[plugin] firebase

Post your completed addons to share with the community

Post » Wed Jul 22, 2015 4:28 pm

I modified your example in order to show what I want to achieve. If I change the variable value after I set a callback, it saves the old value on disconnect.
https://www.dropbox.com/s/7pgqt6r0jzpap9h/set%20value%20on%20disconnect1.capx?dl=0
B
45
S
11
G
4
Posts: 517
Reputation: 7,398

Post » Wed Jul 22, 2015 4:40 pm

@xoros

I dump variable "Var" on console, it shows 10, so it saves 10 while disconnect.

The problem is that the sequence of calling "on receive" event is controlled by firebase api. I am not sure it will be called instantly or later. In this case, it had been called instantly

You might have another private variable to store disconnect-save value independently.
B
109
S
27
G
278
Posts: 4,483
Reputation: 155,426

Post » Wed Jul 22, 2015 6:43 pm

Yes, I think its coming from the server and refers to the value called instantly on start of the layout. I might try C2's browser event on "going offline".
What do you mean by another store on disconnect private variable?

If I call on disconnect set value each time the variable changes, will something be trigger on the server each time or only when I disconnect? It's difficult to explain :)))
B
45
S
11
G
4
Posts: 517
Reputation: 7,398

Post » Thu Jul 23, 2015 12:03 am

@xoros

"only when I disconnect". The setting value of onDisconnect will be overwrote I guess.
B
109
S
27
G
278
Posts: 4,483
Reputation: 155,426

Post » Thu Jul 23, 2015 8:33 am

So it's ok to call it every time? It will not create server traffic?

How does exactly onDisconnect work? It saves the value locally and the server listenes to on disconnect and than when user disconnects from firebase calls this stored value from client side?
B
45
S
11
G
4
Posts: 517
Reputation: 7,398

Post » Thu Jul 23, 2015 8:57 am

@xoros

I guess this onDisconnect value is not saved at local. It will register to server ( i.e. create server traffic ).
B
109
S
27
G
278
Posts: 4,483
Reputation: 155,426

Post » Thu Jul 23, 2015 9:48 am

What do you think, is there any solution how to save updated values onDisconnect only? Sort of an auto save?
B
45
S
11
G
4
Posts: 517
Reputation: 7,398

Post » Thu Jul 23, 2015 9:57 am

@xoros

You could save value (action: set value under "Send - Set") every tick if the value changed every tick.
B
109
S
27
G
278
Posts: 4,483
Reputation: 155,426

Post » Thu Jul 23, 2015 12:21 pm

Oh, but I thought it will create server traffic :))
B
45
S
11
G
4
Posts: 517
Reputation: 7,398

Post » Thu Jul 23, 2015 3:03 pm

@xoros

Yes, it will create server traffic absolutely, since the value is changing and updating every tick. Or you could decrease the updating frequency.

See this page if you are wonder the price.
Free =
50 Max Connections, 5 GB Database Transfer, 100 MB Database Storage. 1 GB Hosting Storage and 100 GB Hosting Transfer.
B
109
S
27
G
278
Posts: 4,483
Reputation: 155,426

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests