DAVID EAST: Oh, this is A cam?
SPEAKER 1: A cam.
DAVID EAST: All right.
Firebase News tonight.
This pattern you're using in Firebase might be killing you!
Tonight, at 11:00.
SPEAKER 1: #AskFirebase number 11, take one, marker.
DAVID EAST: What's up, everybody?
Welcome back to a brand-new episode of #AskFirebase,
the show where we answer all of your Firebase related
questions.
And just as a reminder to you that we're having a super duper
awesome Firebase developer summit in Berlin
on November 7th.
There's going to be Firebase team members there,
and we have exciting product updates for you.
Make sure to stay tuned, and you can check out the link
in the description for more.
I am now adequately caffeinated, so let's answer some questions.
[WHOOSHING SOUND]
Huh.
It's a question.
This question comes from Sander on Twitter.
And Sander asked, since when does Firebase hosting
support http/2?
And Sander, you can use http/2 today.
For those of you who don't know what http/2 is,
it is the new version of the http protocol.
And it has a lot of seriously awesome benefits.
One of them is the fact that you can request multiple things
over one connection, which is a huge upgrade over http/1,
where you need one connection per request.
And that really speeds up your website.
And another thing that Firebase hosting supports
is also http/2 push.
What http/2 push allows you to do
is to proactively push assets down to the browser cache.
So when the web page loads, it's already in there,
and it doesn't have to go out and make
the load on the server.
And this seriously can increase the load time of your web page.
So Sander, if you want to get started
with Firebase hosting in http/2, you can do that today.
Check out our blog post.
The link is in the description.
Great question.
Hey, let's go answer another question.
I'm going to need to do a shake and smile for Gabe.
He's not here, but-- Danielle on Twitter asks,
is there a way to link a transaction
event with the products added to the cart in Firebase Analytics?
Well, Danielle, you can log those parameters
in the e-commerce purchase event.
But for now, BigQuery is really the only way
you can get reporting on it.
But rest assured, we are working hard
on making the Firebase console better for that in the future.
And if you want to learn more about BigQuery and Firebase
Analytics, you should check out a blog post
by Google Cloud developer advocate Sarah
Robinson, who helps you learn how
you can use BigQuery and Google Analytics to better understand
the data in your app.
The link for that is in the description.
Great question, Danielle.
(ROBOTIC VOICE) I have a question to answer.
Rony asks, is calling the database observer over and over
again on the server side a good idea?
And Rony, yes.
It is a good idea, and it's totally expected.
Using the Realtime Database on the server
is really, really powerful.
If you want to connect out to your own backend,
or if you want to do a custom, long-living process,
the Realtime Database SDK on the server is the choice for you.
Let's take a look at some code right here.
So right here, what we're doing is,
we're going to build a chat app where
we want to translate messages to another language.
So right here, the first thing that we're doing
is we're getting the node module that allows us to integrate
with Google Translate.
And then on the next two lines, we're
going to create references to lists
of messages in our database.
So the first one is a list of English messages,
and the second one is a list of Spanish messages.
What we want to do is we want to create
a real-time observer for whenever
a new English message is added.
So we can do the on-trial add an event for our English messages
ref.
And every single time we get a new message,
we'll unwrap the snapshot, and we'll pass its value
into the Google Translate API.
And then after the Google Translate API
does its business, it spits us out the translated messages.
So we can just push that to the Spanish messages list.
And this will work every single time someone adds a new message
to the list.
Yes, Roni, it's totally fine to have the observer called
over and over again.
And it's also completely expected.
If you want to learn more about using the Realtime Database
SDK on the server, check out the link to our documentation.
That will help you get started.
Great question, Roni.
Acting!
(BATMAN VOICE) The people of this city
need me to answer their questions.
Kat asks, hey, #AskFirebase, what
are the benefits of passing an activity to a success listener
on a task that's returned from a Firebase API?
Well, Kat, you would pass that activity
to the success listener, because when
a user leaves the activity, it automatically
gets unregistered for you.
And that means, you don't have to do
anything, which is awesome.
What this does is this helps prevent activity leaks.
This is a really great practice to follow.
If you want to learn more about how
you can do that with all the different Firebase SDKs,
you should check out a blog post series
called "Being a Firebase Taskmaster,"
which is written by Doug Stevenson.
And that's on the official Firebase blog,
so if you want to read that, the link is in the description.
So, Kat, you pass the activity to the success listener,
and it automatically gets unregistered for you.
Great question.
So that's all the questions that we have this week.
If you want your question answered,
make sure to send us a tweet, or go on YouTube or Stack
Overflow.
Just leave the #AskFirebase, and we'll try to get to it.
Also remember that the Firebase dev summit in Berlin
on November 7th is happening.
Check out the link in the description for more.
That's all for today.
If you like this video, make sure to like and subscribe,
so you can stay up to date with all of our great #AskFirebase
videos.
I will see you all later.
[TYPING] I don't know what I'm doing.
Just work, I guess.
[MUSIC PLAYING]
SPEAKER 1: 2-- 1.
DAVID EAST: Ah!
[GROANING] That would have been so good!
[APPLAUSE SOUND EFFECT]