Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

ejabberd_mod_fcm: Firebase Cloud Messaging #13

Open
mrDoctorWho opened this issue Sep 9, 2016 · 14 comments
Open

ejabberd_mod_fcm: Firebase Cloud Messaging #13

mrDoctorWho opened this issue Sep 9, 2016 · 14 comments

Comments

@mrDoctorWho
Copy link
Owner

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

@dan085
Copy link

dan085 commented Oct 20, 2016

@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!!

@ritheshg
Copy link

ritheshg commented May 1, 2017

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

@mrDoctorWho
Copy link
Owner Author

Hi @ritheshg,

What is the type of your message?

@ritheshg
Copy link

ritheshg commented May 1, 2017

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

@mrDoctorWho
Copy link
Owner Author

<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?

@ritheshg
Copy link

ritheshg commented May 1, 2017

  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

@mrDoctorWho
Copy link
Owner Author

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;
	_ ->

@ritheshg
Copy link

ritheshg commented May 2, 2017

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])

@mrDoctorWho
Copy link
Owner Author

So, do your users have subscription both?

@ritheshg
Copy link

ritheshg commented May 3, 2017

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

@mrDoctorWho
Copy link
Owner Author

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

@nileshbacancy
Copy link

nileshbacancy commented Apr 5, 2018

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.

@mrDoctorWho
Copy link
Owner Author

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

@mrDoctorWho
Copy link
Owner Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants