One XMPP connection for more than one GCM/FCM app - google-cloud-messaging

I have a bunch of FCM projects and I'd like to use the same XMPP connection to send messages for all those projects. The FCM docs say that each connection needs to authenticate with the app id and server key, meaning I can use one XMPP connection for one project only. Is there any way around this?

I'm not sure what the question is here. Just use the corresponding Sender ID and Server Key from your Firebase Project. However, do note of the connection limitation mentioned in the docs you linked:
For each sender ID, FCM allows 1000 connections in parallel.
I don't really see any issue here, so long as you're using the same Firebase Project for FCM on all of your apps, you're good to go.
Unfortunately, if you have multiple projects, the only workaround I can only see that you can do is for you to use only a single project for your FCM processes.

Related

Exposed Firebase Cloud Messaging Server Keys

I had used fcm to send notification in my app using api.after some days google send this and removed my app from play store.please help me.
I have tried everywhere not getting exact answer.
Put FCM Key in untrusted environment is a security issue, Any hackers are possible to send message to any user by using FCM key.
FCM key shouldn't exists in your public app like downloaded to your instance, Store in local storage, Hardcode inside application etc.
FCM key should only exists in trusted environment like your server, cloud functions etc.
You can also see this Do I need to protect my firebase Server Key?.

Can a server configured with one Firebase project send notifications to an individual user of an app in a different project?

I am using Firebase with React Native. There are two different projects with one Android app under each project.
My backend server is configured to receive/store the FCM token of every individual app user. Right now, the same backend server caters to both apps. The FCM json config file for the backend server is based on one of the aforementioned two projects.
Can the backend send notifications to an user of either of the two apps, as long as it has their FCM token?
You can do this so long as it comes from the respective apps FCM credentials, this prevents abuse and FCM hijacking. this does not mean that you need cloud functions on multiple projects as you can manually instantiate new admin-sdk modules to connect and send FCM messages as needed.
Initiate Multiple Apps: https://firebase.google.com/docs/admin/setup#initialize-multiple-apps
A side note to consider: You may also be interested in registering the FCM if your app has multiple projects as only the default app is registered with normal behaviour.
FirebaseMessaging.getInstance(firebaseApp) for secondary app supposed to be public but it's private?

Sending push notification from different servers

We have an app. App can register to different servers: Server1 and Server2.
Now, Server1 and Server2 wants to send push notifications to an app independently. How to solve it using GCM?
I don't know how to implement in the sense of SenderID, registration token. Can an app has one SenderID for every app server? Should I has a one SenderID and generates different registration token for every app server?
Now, Server1 and Server2 wants to send push notifications to an app independently. How to solve it using GCM?
Have each server create their own FCM project (it seems you're a new user so it would be advisable to proceed using FCM now), each would have it's own SenderId, which the client would be generating a token for each (see my answer here or here).
Then have the servers send to their corresponding tokens as needed.
Can an app has one SenderID for every app server?
Yup. See what I mentioned above.
Should I has a one SenderID and generates different registration token for every app server?
Yup. It's the correct approach, see what mentioned above.

Register as client to GCM

I am testing a server that uses google cloud messaging (GCM)
In order to perform the test without an actual device (for a faster way and actually test only the server side)
I am looking for a way to register as a client WITHOUT a device
I have from the server the project id and the sender id
But I see that I need an instanse id of the client in order to register to GCM (via https: //android.googleapis.com/gcm/send)
Is it possible to generate an instance id without an actual client?
P.S.
Maybe it will help I have found this code of Angular GCM client, and Python GCM client
but i couldn't succeeded to find a solution for registration yet
Thank you
I don't think you can remove the "client app" out of the equation as it is part of the architectural components of GCM:
A GCM implementation includes a Google connection server, an app
server in your environment that interacts with the connection server
via HTTP or XMPP protocol, and a client app.
However if you meant, without a real device, try using the emulator.

Can i create a custom authentication system on top of SkylinkJS

i'm building a website that uses WebRTC to share audio and video. Now i'd like to access WebRTC features on Android devices so i can create an app that can receives audio and video streams from the website.
I've looked for a technology allowing me to do that and I've found SkylinkJS.
It looks great but i'm wondering something. Can i build a custom authentication system on top of SkylinkJS logic. What i mean is that i'd like to make sure the connection to SkylinkJS rooms are initiated by users actually authenticated on my platform.
At the moment, i do that using socket.io but i can do it since i'm using raw WebRTC. How can i do that using SkylinkJS? Using the REST API?
Thanks.
PS: i cannot tag this question with 'skylinkjs' since it's a new tag, but it mights be cool if someone could do it.
Yes you can integrate that with the REST API in this Applications REST API link here - . You can generate your own credentials.
You can generate the connecting credentials from your server and then when the User logs in, generate the credentials for Users to connect to the Room. See more in their support article.
SkylinkJS uses key based authentication mechanism to authenticate against the Temasys signaling servers. This ensures that any application using Skylink can only connect to calls in your application if the app can provide the same secure keys (from your Temasys developer account).
Your best bet in looping in Android would be to use the android counterpart. http://skylink.io/android/