Android Question [Resolved] FCM send from client to client

AymanA

Active Member
Licensed User
Hi @LucaMs/All

Apologies I opened this thread in order not to post on older one.


I agree with your statement for not to include the API key in the client code, and I agree that it is not clear on how this can be implemented.

I have been researching this for a while ( b4x and other) but I am still in confusion and not sure what is the correct approach to implement a client to send notification based on topic to other client(s).

I have seen some websites refer to that it is a must to have app server to process all messages to client, but how this app server can receive those notification messages.

One thing that I have in mind to solve this is to use MQTT to send the payload (the notification data) to VM, save/compare the token to DB, then either use the B4Jsending-tool (or B4J APP) to send the notification to the clients.

Again I am not sure if this is the right or correct approach to do this, but my use case for this in my app, is that I will have section for admin to send notification to specific users based on topic.

Advice will be much appreciated for best practice, or if someone implemented this before.

Thanks
 

AymanA

Active Member
Licensed User
I use php with a db on a server. Works like a charm. An B4J app as a server works fine to.

Ok so I have a question because i have read about this and i have concern about the security risk, so if i understand this process correctly, from the client app you insert the notification data to remote db? And then php script compares the token to the db and the send to fcm server for publish?

If that is the process then please correct me, but this might be a security risk to connect to remote db directly am I correct or you are using API or may be JRDC2?
 
Upvote 0

AymanA

Active Member
Licensed User
Thanks Erel, so for the data from client( that will send the notification) to B4J server, I assume there is no connection at all with the FCM at this point - in other word the data is sent from client to the B4J server --> then B4J server will connect to the FCM to send the notification to the topic/Token in question am I correct?

Apologies when you say sending tool, you mean to have something like websocket/MQTT/JRDC2? is their any library/communication method you recommend between the sending client and the B4J server?
 
Upvote 0

Erel

Administrator
Staff member
Licensed User
I assume there is no connection at all with the FCM at this point - in other word the data is sent from client to the B4J server --> then B4J server will connect to the FCM to send the notification to the topic/Token in question am I correct?
True.

Apologies when you say sending tool, you mean to have something like websocket/MQTT/JRDC2? is their any library/communication method you recommend between the sending client and the B4J server?
jRDC2 is not communication platform.
WebSocket is less relevant here as you don't need a continuous connection.
MQTT can be used though I wouldn't use it here.
A simple B4J server (jServer) with http handler is a good option here.
You will then send the requests with OkHttpUtils2.

Important information: Resumable Subs (wait for / sleep) in server handlers
 
Upvote 0

AymanA

Active Member
Licensed User
Thank you so much, really appreciate your help! This has cleared the confusion I have for this topic :)
 
Upvote 0
Top