GithubHelp home page GithubHelp logo

Comments (10)

robobit avatar robobit commented on August 29, 2024

Are you sure you are breaking the connection and not gracefully ending it with a presence update and a stream close? Some client libraries, such as Strophe, will do this for you automatically when you stop your app.

from mod_push.

BesatZardosht avatar BesatZardosht commented on August 29, 2024

I don't send presence update. I simply double-click on the Home button to access the multitasking tray and then swipe up on the app to close it. Is there any way to check the stream state?

from mod_push.

robobit avatar robobit commented on August 29, 2024

You will see it in the ejabberd log.

Also you will have to send an $iq stanza to enable the notifications, besides the registration (I don't see this in your steps.

from mod_push.

BesatZardosht avatar BesatZardosht commented on August 29, 2024

Oh.. maybe that is the problem! THANK YOU!
How should this iq be?
I really appreciate if you can give me an example since I can't see any example in mod_push read me

from mod_push.

BesatZardosht avatar BesatZardosht commented on August 29, 2024

this is my ejabberd log after I kill my app. There are two errors in my log

2016-02-16 17:33:12.043 [info] <0.690.0>@ejabberd_c2s:terminate:1785 ({socket_state,gen_tcp,#Port<0.14022>,<0.689.0>}) Close session for [email protected]/123456

2016-02-16 17:33:12.046 [error] <0.650.0>@ejabberd_hooks:run_fold1:368 {undef,[{mod_push,on_affiliation_removal,[{xmlel,<<"presence">>,[{<<"from">>,<<"[email protected]/123456">>},{<<"to">>,<<"[email protected]/78901">>},{<<"type">>,<<"unavailable">>}],[]},{state,{socket_state,gen_tcp,#Port<0.13995>,<0.649.0>},ejabberd_socket,#Ref<0.0.3.2901>,false,<<"14099723632861619090">>,undefined,c2s,c2s_shaper,false,true,false,false,[verify_none,compression_none,{protocol_options,<<"no_sslv3">>},{certfile,<<"/Applications/ejabberd-push/etc/ejabberd/server.pem">>}],true,{jid,<<"testuser10">>,<<"myserver.com">>,<<"78901">>,<<"testuser10">>,<<"myserver.com">>,<<"78901">>},<<"testuser10">>,<<"myserver.com">>,<<"78901">>,{{1455,642890,775487},<0.650.0>},{2,{{<<"testuser6">>,<<"myserver.com">>,<<>>},{{<<"testuser10">>,<<"myserver.com">>,<<>>},nil,nil},nil}},{2,{{<<"testuser6">>,<<"myserver.com">>,<<>>},{{<<"testuser10">>,<<"myserver.com">>,<<>>},nil,nil},nil}},{3,{{<<"testuser10">>,<<"myserver.com">>,<<>>},{{<<"mytestroom">>,<<"conference.myserver.com">>,<<"testuser10">>},nil,nil},{{<<"testuser6">>,<<"myserver.com">>,<<>>},nil,nil}}},{xmlel,<<"presence">>,[{<<"type">>,<<"online">>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"vcard-tempupdate">>}],[{xmlel,<<"photo">>,[],[]}]}]},{1455,642892,922642},{userlist,none,[],false},c2s,ejabberd_auth_ldap,{{10,0,1,111},62145},[{caps_resources,{0,nil}}],active,[],inactive,undefined,undefined,1000,undefined,300,300,false,0,0,<<>>},{jid,<<"testuser10">>,<<"myserver.com">>,<<"78901">>,<<"testuser10">>,<<"myserver.com">>,<<"78901">>},{jid,<<"testuser6">>,<<"myserver.com">>,<<"820496...">>,...},...],...},...]}
running hook: {user_receive_packet,[{state,{socket_state,gen_tcp,#Port<0.13995>,<0.649.0>},ejabberd_socket,#Ref<0.0.3.2901>,false,<<"14099723632861619090">>,undefined,c2s,c2s_shaper,false,true,false,false,[verify_none,compression_none,{protocol_options,<<"no_sslv3">>},{certfile,<<"/Applications/ejabberd-push/etc/ejabberd/server.pem">>}],true,{jid,<<"testuser10">>,<<"myserver.com">>,<<"78901">>,<<"testuser10">>,<<"myserver.com">>,<<"78901">>},<<"testuser10">>,<<"myserver.com">>,<<"78901">>,{{1455,642890,775487},<0.650.0>},{2,{{<<"testuser6">>,<<"myserver.com">>,<<>>},{{<<"testuser10">>,<<"myserver.com">>,<<>>},nil,nil},nil}},{2,{{<<"testuser6">>,<<"myserver.com">>,<<>>},{{<<"testuser10">>,<<"myserver.com">>,<<>>},nil,nil},nil}},{3,{{<<"testuser10">>,<<"myserver.com">>,<<>>},{{<<"mytestroom">>,<<"conference.myserver.com">>,<<"testuser10">>},nil,nil},{{<<"testuser6">>,<<"myserver.com">>,<<>>},nil,nil}}},{xmlel,<<"presence">>,[{<<"type">>,<<"online">>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"vcard-tempupdate">>}],[{xmlel,<<"photo">>,[],[]}]}]},{1455,642892,922642},{userlist,none,[],false},c2s,ejabberd_auth_ldap,{{10,0,1,111},62145},[{caps_resources,{0,nil}}],active,[],inactive,undefined,undefined,1000,undefined,300,300,false,0,0,<<>>},{jid,<<"testuser10">>,<<"myserver.com">>,<<"78901">>,<<"testuser10">>,<<"myserver.com">>,<<"78901">>},{jid,<<"testuser6">>,<<"myserver.com">>,<<"123456">>,<<"testuser6">>,<<"myserver.com">>,<<"123456">>},{jid,<<"testuser10">>,<<"myserver.com">>,<<"78901">>,...}]}

2016-02-16 17:33:12.048 [error] <0.650.0>@ejabberd_hooks:run_fold1:368 {undef,[{mod_push,on_affiliation_removal,[{xmlel,<<"presence">>,[{<<"from">>,<<"[email protected]/testuser6">>},{<<"to">>,<<"[email protected]/78901">>},{<<"type">>,<<"unavailable">>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"http://jabber.org/protocol/muc#user">>}],[{xmlel,<<"item">>,[{<<"jid">>,<<"[email protected]/123456">>},{<<"affiliation">>,<<"owner">>},{<<"role">>,<<"none">>}],[]}]}]},{state,{socket_state,gen_tcp,#Port<0.13995>,<0.649.0>},ejabberd_socket,#Ref<0.0.3.2901>,false,<<"14099723632861619090">>,undefined,c2s,c2s_shaper,false,true,false,false,[verify_none,compression_none,{protocol_options,<<"no_sslv3">>},{certfile,<<"/Applications/ejabberd-push/etc/ejabberd/server.pem">>}],true,{jid,<<"testuser10">>,<<"myserver.com">>,<<"78901">>,<<"testuser10">>,<<"myserver.com">>,<<"78901">>},<<"testuser10">>,<<"myserver.com">>,<<"78901">>,{{1455,642890,775487},<0.650.0>},{2,{{<<"testuser6">>,<<"myserver.com">>,<<>>},{{<<"testuser10">>,<<"myserver.com">>,<<>>},nil,nil},nil}},{2,{{<<"testuser6">>,<<"myserver.com">>,<<>>},{{<<"testuser10">>,<<"myserver.com">>,<<>>},nil,nil},nil}},{3,{{<<"testuser10">>,<<"myserver.com">>,<<>>},{{<<"mytestroom">>,<<"conference.myserver.com">>,<<"testuser10">>},nil,nil},{{<<"testuser6">>,<<"myserver.com">>,<<>>},nil,nil}}},{xmlel,<<"presence">>,[{<<"type">>,<<"online">>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"vcard-tempupdate">>}],[{xmlel,<<"photo">>,[],[]}]}]},{1455,642892,922642},{userlist,none,[],false},c2s,ejabberd_auth_ldap,{{10,0,1,111},62145},[{caps_resources,{0,nil}}],active,[],inactive,undefined,undefined,1000,undefined,300,300,false,0,0,<<>>},{jid,<<"testuser10">>,<<"myserver.com">>,<<"11497...">>,...},...],...},...]}
running hook: {user_receive_packet,[{state,{socket_state,gen_tcp,#Port<0.13995>,<0.649.0>},ejabberd_socket,#Ref<0.0.3.2901>,false,<<"14099723632861619090">>,undefined,c2s,c2s_shaper,false,true,false,false,[verify_none,compression_none,{protocol_options,<<"no_sslv3">>},{certfile,<<"/Applications/ejabberd-push/etc/ejabberd/server.pem">>}],true,{jid,<<"testuser10">>,<<"myserver.com">>,<<"78901">>,<<"testuser10">>,<<"myserver.com">>,<<"78901">>},<<"testuser10">>,<<"myserver.com">>,<<"78901">>,{{1455,642890,775487},<0.650.0>},{2,{{<<"testuser6">>,<<"myserver.com">>,<<>>},{{<<"testuser10">>,<<"myserver.com">>,<<>>},nil,nil},nil}},{2,{{<<"testuser6">>,<<"myserver.com">>,<<>>},{{<<"testuser10">>,<<"myserver.com">>,<<>>},nil,nil},nil}},{3,{{<<"testuser10">>,<<"myserver.com">>,<<>>},{{<<"mytestroom">>,<<"conference.myserver.com">>,<<"testuser10">>},nil,nil},{{<<"testuser6">>,<<"myserver.com">>,<<>>},nil,nil}}},{xmlel,<<"presence">>,[{<<"type">>,<<"online">>}],[{xmlel,<<"x">>,[{<<"xmlns">>,<<"vcard-tempupdate">>}],[{xmlel,<<"photo">>,[],[]}]}]},{1455,642892,922642},{userlist,none,[],false},c2s,ejabberd_auth_ldap,{{10,0,1,111},62145},[{caps_resources,{0,nil}}],active,[],inactive,undefined,undefined,1000,undefined,300,300,false,0,0,<<>>},{jid,<<"testuser10">>,<<"myserver.com">>,<<"78901">>,<<"testuser10">>,<<"myserver.com">>,<<"78901">>},{jid,<<"mytestroom">>,<<"conference.myserver.com">>,<<"testuser6">>,<<"mytestroom">>,<<"conference.myserver.com">>,<<"testuser6">>},{jid,<<"testuser10">>,<<"myserver.com">>,<<"78901">>,<<"testuser10">>,<<"myserver.com">>,<<"114979279057583647981...">>}]}

from mod_push.

royneary avatar royneary commented on August 29, 2024

I merged a fix yesterday, did you pull that?

The enable stanza should look similar to this:

<iq type='set' id='x43'>
  <enable xmlns='urn:xmpp:push:0' jid='push.myserver.com' node='yxs32uqsflafdk3iuqo'>
    <x xmlns='jabber:x:data'>
      <field var='FORM_TYPE'><value>http://jabber.org/protocol/pubsub#publish-options</value></field>
      <field var='secret'><value>eruio234vzxc2kla-91<value></field>
    </x>
  </enable>
</iq>

There are examples in XEP-0357.

from mod_push.

royneary avatar royneary commented on August 29, 2024

And yes, it should work with the sandbox server, actually it only works with the sandbox server currently ;-)

@robobit, I saw you implemented a sandbox config option. I should adopt that. Just too busy at the moment.

from mod_push.

robobit avatar robobit commented on August 29, 2024

Something like this:

<iq type='set' id='x43'>
  <enable xmlns='urn:xmpp:push:0' jid='push-5.client.example' node='yxs32uqsflafdk3iuqo'>
    <x xmlns='jabber:x:data'>
      <field var='FORM_TYPE'><value>http://jabber.org/protocol/pubsub#publish-options</value></field>
      <field var='secret'><value>eruio234vzxc2kla-91<value></field>
    </x>
  </enable>
</iq>

See XEP-0357: Push Notification specification.

In your log you should see something like below when a client disconnects (this is at log level 5). (The first part would look different if your not using websockets like I am). Especially look out for the ejabberd_c2s:fm_next_state and the mod_push log entries.

2016-02-16 18:47:39.291 [debug] <0.1211.0>@ejabberd_websocket:process_frame:338 WebSocket close op unknown: <<>>
2016-02-16 18:47:50.006 [debug] <0.1212.0>@ejabberd_http_ws:terminate:263 C2S Pid : <0.1213.0>
2016-02-16 18:47:50.006 [debug] <0.1211.0>@ejabberd_http:send_text:183 Error in p1_tls:send: {error,einval}
2016-02-16 18:47:50.007 [info] <0.1214.0>@ejabberd_c2s:fsm_next_state:2505 Waiting for resumption of stream for [email protected]/wbm
2016-02-16 18:47:50.007 [debug] <0.1214.0>@mod_push:dispatch:690 +++++ dispatch: found push_user
2016-02-16 18:47:50.007 [debug] <0.1214.0>@mod_push:dispatch:697 +++++ NewSubscrs = [{subscription,<<"wbm">>,true,<<"4218060266">>,{local_reg,<<"push.mysecretserver.com">>,<<"3628156109">>}}]
2016-02-16 18:47:50.007 [debug] <0.1214.0>@mod_push:dispatch:704 +++++ dispatch: found subscription
2016-02-16 18:47:50.007 [debug] <0.1214.0>@mod_push:on_wait_for_resume:1022 +++++++ adjusting timeout to 8640000

Also I forgot to mention that you will need to enable and handle stream managment XEP-0198: Stream Management.

from mod_push.

BesatZardosht avatar BesatZardosht commented on August 29, 2024

I appreciate all your helps and responses!!

the push service is enables. I get this feature in disco#info:
<feature var="urn:xmpp:push:0"/>

Steam_management default value is true but I have set it in ejabberd.yml just in case:
stream_management: true

I pulled mod_push from here.

set the log level to 5. but I can't see mod_push log info.

And it is still not working!

from mod_push.

robobit avatar robobit commented on August 29, 2024

From the feature info you can't conclude that the push service is enabled. It just means that your ejabberd supports the push feature. You still have to register for it and enable it (that 2 stanzas as described earlier).
Same for the stream management, look for the ejabberd_c2s:fsm_next_state:2505 Waiting for resumption of stream in your log when you quit your app (this can take a while because there is a (configurable) timeout). If you don't see this then you don't have the prerequisites setup for mod_push.

I hope this helps.

from mod_push.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.