Firestore Chat app Using PHP

146 views
Skip to first unread message

Marwan Aswad

unread,
Jun 11, 2021, 4:24:21 AM6/11/21
to Firebase Google Group

Hello,

I need to implement a chat feature in my website and my mobile apps (Android and iOS) using Firebase Firestore.

I am a PHP web developer and I am new to firebase.

I found in the documentation 2 ways to implement the chat on web:
1. Using Web JS (direct calls to firebase without passing through a server)
2. Using Server as a middleware between client and firebase

What I already implemented is the web JS SDK, but I have a concern here. My public API key will be exposed to all users and all JS functionalities will also be visible to any one. Is it safe to leave it like this?

I used the login with custom token function (the custom token is returned from the server after user logged in via API) then at client side I validated the custom token by fetching the TokenId.

The second option of using the server as a middleware, I couldn't find a way to make real time requests so when the user sends a message to another user, I need to display the message for the other user ini realtime.

Any advice please?
Thank you
Reply all
Reply to author
Forward
0 new messages