royneary / mod_push

Other
68 stars 19 forks source link

GCM doesn't seem to work (tested manually) #15

Open ezraimanuel opened 8 years ago

ezraimanuel commented 8 years ago

Hello, related to previous issue, mod_push doesn't seem to send anything to GCM server nor receiving anything from it.

I used Converstations app, connecting to my ejabberd. During connection to my XMPP server, the app received packet as expected and it showed that push server is enabled, as follows:

03-19 19:14:23.893 4212-4238/? D/conversations: account@domain.tld: Enabling push on server. Received packet: <x xmlns="jabber:x:data" type="result"><field xmlns="jabber:x:data" var="jid"><value xmlns="jabber:x:data">pubsub.domain.tld</value></field><field xmlns="jabber:x:data" var="node"><value xmlns="jabber:x:data">MY_NODE_ID</value></field><field xmlns="jabber:x:data" var="secret"><value xmlns="jabber:x:data">MY_SECRET_VALUE</value></field></x> 03-19 19:14:24.583 4212-4238/? D/conversations: account@domain.tld: successfully enabled push on server 03-19 19:14:24.583 4212-4238/? D/conversations: account@domain.tld: Received packet: <iq to="account@domain.tld/resource" from="account@domain.tld" xmlns="jabber:client" type="result" id="tbpc3dfmh1"/> 03-19 19:14:24.583 4212-4238/? D/conversations: account@domain.tld: Packet type: RESULT 03-19 19:15:20.223 4212-4212/? D/conversations: app switched into background

I tried everything to make sure the app is no longer running: shutting the down client, killing the background service, clearing notifications, use CM cleaner, even hibernate the app using Greenify, shutting down the screen, until I'm sure that the app is no longer running (I debug using Android studio, yes it went down as expected, no more activities in debug window). Also the ejabberd showed that connection already lost, as expected:

2016-03-19 19:20:30.470 [info] <0.2346.0>@ejabberd_c2s:fsm_next_state:2436 Waiting for resumption of stream for account@domain.tld/resource

Then, I tried manually send packet to GCM server:

curl -s "https://android.googleapis.com/gcm/send" -H "Authorization: key=MY_GCM_KEY" -H "Content-Type: application/json" -d '{"to": "MY_DEVICE_TOKEN_ID", "data": {"score": 123}}' And viola, the App is up and re-connecting to the server, as expected:

03-19 19:24:16.383 6754-6772/? D/conversations: GCM message received @ 108416663 03-19 19:24:17.163 6754-6774/? D/conversations: restoring roster 03-19 19:24:17.173 6754-6754/? D/conversations: update unread count to 0 03-19 19:24:17.183 6754-6754/? D/conversations: gcm push message arrived in service. extras=Bundle[mParcelledData.dataSize=116] 03-19 19:24:17.213 6754-6780/? D/conversations: account@domain.tld: connecting

Which left to conclusion that ejabberd server didn't send/receive anything from GCM server, any ideas why and how do I check for it? I also tried monitoring the server traffic and no packets to/from GCM server captured.

thank you

ezraimanuel commented 8 years ago

Ah yes, in case this info will help, I forgot to mention that I use ejabberd v16.02 from https://www.process-one.net/en/ejabberd/downloads/, I didn't use ejabberd-mod_push_adjustment since it's seems a bit outdated. What exactly adjustments that you made there? Should I do the same with original ejabberd or should I use the mod_push_adjustment version?

thank you :)

ezraimanuel commented 8 years ago

ahhh.... yes I found the issue, seems mod_push cannot interact very well with the original ejabberd.

I tried using your mod-push-adjustment ejabberd, and I got this:

2016-03-20 13:13:54.856 [debug] <0.2876.0>@mod_push:on_store_stanza:655 ++++++++++++ Stored Stanza for {jid,<<"account">>,<<"domain.tld">> (never got this when using original ejabberd 16.02)

Well it works... um is there anyway we can make this work with original ejabberd 16.02?

thanks