ejabberd_mod_gcm icon indicating copy to clipboard operation
ejabberd_mod_gcm copied to clipboard

ejabberd_mod_fcm: Firebase Cloud Messaging

Open mrDoctorWho opened this issue 8 years ago • 14 comments

https://firebase.google.com/docs/cloud-messaging/send-message

mrDoctorWho avatar Sep 09 '16 06:09 mrDoctorWho

@mrDoctorWho Hello, I hope this very well. In the module only change the url by -defines (NS_FCM, "https://fcm.googleapis.com/fcm"). and works perfectly in my server!!

dan085 avatar Oct 20 '16 14:10 dan085

Hello mrDoctorWho ,

I have integrated mod_gcm with ejabberd and FCM for Android. I just followed instructions and setup mod_gcm, everything seems to be fine. But when I receive offline message, it is received by mod_gcm but further not sent to FCM.

I could see debug message at server "mod_gcm: got offline message" but when I debugged found out that it is not entering into below case statement where message sent to FCM. Could you please let me know if I am missing anything related to configuration at server or while sending a stanza from client ?

Stanza from client side,

<iq to='my_xmpp_server' from='rahul' id='eMUAt-728' type='set'>
<register xmlns='https://mytestxmppappfcm.firebaseio.com'><key>client token id</key></register>
</iq>

Flow does not get into case statement at server.

		%% Checking subscription
		{Subscription, _Groups} = 
			ejabberd_hooks:run_fold(roster_get_jid_info, ToServer, {none, []}, [ToUser, ToServer, From]),
		case Subscription of

ritheshg avatar May 01 '17 06:05 ritheshg

Hi @ritheshg,

What is the type of your message?

mrDoctorWho avatar May 01 '17 13:05 mrDoctorWho

It is 'Type.chat', I am using Smack library at Android client side and sending 'Message' to other end.

ritheshg avatar May 01 '17 14:05 ritheshg

<register xmlns='https://mytestxmppappfcm.firebaseio.com'>

What is that URL? Have you changed it in the code as well? Were there any other changes in the code?

What ejabberd version are you using?

Are there any other modules installed that might rely on offline messages?

mrDoctorWho avatar May 01 '17 14:05 mrDoctorWho

  1. This is the firebase URL I got it in 'google-services.json' after creating a project in Firebase console. I have changed in code as below, -define(NS_GCM, "https://mytestxmppappfcm.firebaseio.com").

Snippet from 'google-services.json'

"project_info": {
   "project_number": "417769686398",
   "firebase_url": "https://mytestxmppappfcm.firebaseio.com",
   "project_id": "mytestxmppappfcm",
   "storage_bucket": "mytestxmppappfcm.appspot.com"
 },
  1. I am using ejabberd version 16.04.61

  2. Using below but same state is observed even after disabling this module.

 mod_offline:
   access_max_user_messages: max_user_offline_messages

ritheshg avatar May 01 '17 15:05 ritheshg

Flow does not get into case statement at server.

I don't think the execution flow could just stop on this. Did it go through the case below?

case Type of 
	"normal" -> ok;
	_ ->

mrDoctorWho avatar May 02 '17 09:05 mrDoctorWho

Yes, It got into "normal" -> ok; and executed below statement.

{Subscription, _Groups} =
                                ejabberd_hooks:run_fold(roster_get_jid_info, ToServer, {none, []}, [ToUser, ToServer, From])

ritheshg avatar May 02 '17 14:05 ritheshg

So, do your users have subscription both?

mrDoctorWho avatar May 03 '17 04:05 mrDoctorWho

Yes, both the users have subscribed. And below debug messages are shown for both the users, mod_gcm: updating last_seen for user [username]

ritheshg avatar May 03 '17 12:05 ritheshg

@ritheshg Could you please check if the original module works fine for you?

mrDoctorWho avatar May 05 '17 03:05 mrDoctorWho

Hello @mrDoctorWho , @ritheshg , @dverdugo85 any one know how to FCM pushnotification in ejabberd same like below GCM link: https://github.com/joanlopez/ejabberd-mod-gcm https://github.com/joanlopez/ejabberd-mod-gcm/blob/master/src/mod_gcm.erl

Please help me if there is any mod_fcm.erl file I have installed 16.09 ejabberd version.

nileshbacancy avatar Apr 05 '18 06:04 nileshbacancy

@nileshbacancy I don't know if there's any

mrDoctorWho avatar May 16 '18 07:05 mrDoctorWho

Firebase is to replace GCM by April 11, 2019. I probably should have a look into that.

mrDoctorWho avatar May 16 '18 07:05 mrDoctorWho