Firebase Database

Hi All,

Please can you help me with the firebase. My purpose is to get and send data to the firebase database.

Thank You.


Hi @Mohamed_Abdelhady,

You can definitely use Firebase with Playcanvas, in the same manner you would be using it with any other HTML/JS website or application.

Here is how you can get started with Realtime Firebase (Firestore will be similar):

1 Like

How about multiplayer playcanvas on Firebase? Firebase lacks support for so we would have to use websocket. Does playcanvas work with Websocket?

PlayCanvas is a web based application, so it supports whatever the browser running it supports. Websockets are supported by most, if not all, modern browsers, so yes.

Firebase can work for multiplayer, but it can be a bit slow if you are planning in replicating real time movement. Sometimes the latency can be high 300-500ms. It depends on your case, it may not be a showstopper, or even the latency issue may have been improved.

The Firebase SDK is great for setting up a networking on your game quickly. But the biggest problem in using like that can be the cost. Since you are being charged for both reads and writes, it can get expensive fast.

great info. Based on my reading of the forum, photon engine sounds like cost effective with low lag? Also which hosting do you recommend for low cost and low latency?

Yes, I’d say photon is definitely more game oriented, whereas firebase is more of a serverless database. But definitely do some research on this, it’s been sometime since I’ve last used Firebase for something like this (~1.5 years).

For low cost and low latency node.js hosting you can setup a digital ocean or linode instance, I think they start from as low as 5$ a month or something?

But you need to be educated on how the linux command line works to setup everything. There are plenty of tutorials and guides to follow on that subject.

1 Like

Thank you!

1 Like

@Leonidas i would wondering , to install firebase it needs to call npm install firebase from terminal which seems just downloading files to the current directory of my computer. what if i am developing via playcanvas editor ? should i just upload those folders and files to editor ?

Hello @Calvin2274,

I wrote some steps on how to use Firebase with PlayCanvas some time ago. You can take a look here:

1 Like