Wrox Programmer Forums
|
BOOK: Professional XMPP Programming with JavaScript and jQuery
This is the forum to discuss the Wrox book Professional XMPP Programming with JavaScript and jQuery by Jack Moffitt; ISBN: 978-0-470-54071-8
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional XMPP Programming with JavaScript and jQuery section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 21st, 2012, 11:37 PM
leo leo is offline
Registered User
 
Join Date: Oct 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default muc problem on android device

hi i'm developing muc on android device using chat8 group chatting source

<<development environment>>
1. openfire 3.7.1
2. apache HTTP server 2.2
ProxyRequests Off
ProxyPass /xmpp-httpbind http://127.0.0.1:7070/http-bind/
ProxyPassReverse /xmpp-httpbind http://127.0.0.1:7070/http-bind/
3. android 2.2(version 8) - samsung galaxy2 phone
4. jquery : 1.8.2 , phonegap : cordova-2.1.

everything is perfect on web(ie 8) but there is problem on android device.
problem is, if i send a message everything is ok, but if i didn't send a message to openfire server, connection is terminate after 30 seconds with this message --> <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='policy-violation'/>.
or if there was no paticipant(except me) in multi user chat room, connection is terminate after 30 seconds.
what is the problem ?
rid and sid is ok, see below

<< log >>
10-22 12:14:26.225: D/CordovaLog(29238): ##### Strophe.Status = connecting
10-22 12:14:26.245: D/CordovaLog(29238): SENT: <body rid='82835747' xmlns='http://jabber.org/protocol/httpbind' to='localhost' xml:lang='en' wait='60' hold='1' window='5' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/>
10-22 12:14:26.565: D/CordovaLog(29238): RECV: <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams' authid='1c09f262' sid='1c09f262' secure='true' requests='2' inactivity='30' polling='5' wait='60' hold='1' ack='82835747' maxpause='300' ver='1.6'><stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms><compression xmlns='http://jabber.org/features/compress'><method>zlib</method></compression><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></stream:features></body>
10-22 12:14:26.565: D/CordovaLog(29238): ##### Strophe.Status = AUTHENTICATING
10-22 12:14:26.565: D/CordovaLog(29238): SENT: <body rid='82835748' xmlns='http://jabber.org/protocol/httpbind' sid='1c09f262'><auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'/></body>
10-22 12:14:26.685: D/CordovaLog(29238): RECV: <body xmlns='http://jabber.org/protocol/httpbind'><challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>cmVhbG09ImxvY2FsaG9zdCIsbm9uY2U9IloxWkg4OHVq QmxoVTM3VHg0TmVaVWlabUNzeXY2WGx5V2x1Z1RiUXYiLHFvcD 0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bWQ1LXNl c3M=</challenge></body>
10-22 12:14:26.780: D/CordovaLog(29238): SENT: <body rid='82835749' xmlns='http://jabber.org/protocol/httpbind' sid='1c09f262'><response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>dXNlcm5hbWU9ImpveW5sZW8iLHJlYWxtPSJsb2NhbGhv c3QiLG5vbmNlPSJaMVpIODh1akJsaFUzN1R4NE5lWlVpWm1Dc3 l2NlhseVdsdWdUYlF2Iixjbm9uY2U9ImQ0MWQ4Y2Q5OGYwMGIy MDRlOTgwMDk5OGVjZjg0MjdlIixuYz0iMDAwMDAwMDEiLHFvcD 0iYXV0aCIsZGlnZXN0LXVyaT0ieG1wcC9sb2NhbGhvc3QiLHJl c3BvbnNlPSJjMDljYjgxOThiODM4ODRhMDkwNTc2MTUzMzU3Nm QxNiIsY2hhcnNldD0idXRmLTgi</response></body>
10-22 12:14:26.830: D/CordovaLog(29238): RECV: <body xmlns='http://jabber.org/protocol/httpbind'><success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>cnNwYXV0aD1hYjA0MDc4M2JkNWQ5YTM2MDdkNDcyYTI5 YmUyZmM2Yg==</success></body>
10-22 12:14:26.875: D/CordovaLog(29238): SENT: <body rid='82835750' xmlns='http://jabber.org/protocol/httpbind' sid='1c09f262' to='localhost' xml:lang='en' xmpp:restart='true' xmlns:xmpp='urn:xmpp:xbosh'/>
10-22 12:14:26.875: D/CordovaLog(29238): RECV: <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'><stream:features><compression xmlns='http://jabber.org/features/compress'><method>zlib</method></compression><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></stream:features></body>
10-22 12:14:26.970: D/CordovaLog(29238): SENT: <body rid='82835751' xmlns='http://jabber.org/protocol/httpbind' sid='1c09f262'><iq type='set' id='_bind_auth_2' xmlns='jabber:client'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/></iq></body>
10-22 12:14:27.145: D/CordovaLog(29238): RECV: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client' type='result' id='_bind_auth_2' to='localhost/1c09f262'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>joynleo@localhost/1c09f262</jid></bind></iq></body>
10-22 12:14:27.245: D/CordovaLog(29238): SENT: <body rid='82835752' xmlns='http://jabber.org/protocol/httpbind' sid='1c09f262'><iq type='set' id='_session_auth_2' xmlns='jabber:client'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq></body>
10-22 12:14:27.260: D/CordovaLog(29238): RECV: <body xmlns='http://jabber.org/protocol/httpbind'><iq xmlns='jabber:client' type='result' id='_session_auth_2' to='joynleo@localhost/1c09f262'/></body>
10-22 12:14:27.260: D/CordovaLog(29238): ##### Strophe.Status = connected
10-22 12:14:27.390: D/CordovaLog(29238): SENT: <body rid='82835753' xmlns='http://jabber.org/protocol/httpbind' sid='1c09f262'><presence xmlns='jabber:client'><priority>-1</priority></presence><presence to='[email protected]/joynleo' xmlns='jabber:client'><x xmlns='http://jabber.org/protocol/muc'/></presence></body>
10-22 12:14:27.465: D/CordovaLog(29238): RECV: <body xmlns='http://jabber.org/protocol/httpbind'><presence xmlns='jabber:client' to='joynleo@localhost/1c09f262' from='[email protected]/joy'><x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='none' role='participant'/></x></presence></body>
10-22 12:14:27.490: D/CordovaLog(29238): SENT: <body rid='82835754' xmlns='http://jabber.org/protocol/httpbind' sid='1c09f262'/>
10-22 12:14:27.550: D/CordovaLog(29238): RECV: <body xmlns='http://jabber.org/protocol/httpbind'><presence xmlns='jabber:client' to='joynleo@localhost/1c09f262' from='[email protected]/joynleo'><x xmlns='http://jabber.org/protocol/muc#user'><item affiliation='none' role='participant'/></x></presence><message xmlns='jabber:client' type='groupchat' from='[email protected]' to='joynleo@localhost/1c09f262'><subject>test room</subject><delay xmlns='urn:xmpp:delay' stamp='2012-10-17T09:15:11.467Z' from='[email protected]'/><x xmlns='jabber:x:delay' stamp='20121017T09:15:11' from='[email protected]'/></message><message xmlns='jabber:client' to='joynleo@localhost/1c09f262' type='groupchat' from='[email protected]/joy'><body>hello</body><delay xmlns='urn:xmpp:delay' stamp='2012-10-22T01:21:54.186Z' from='[email protected]/joy'/><x xmlns='jabber:x:delay' stamp='20121022T01:21:54' from='[email protected]/joy'/></message><message xmlns='jabber:client' to='joynleo@localhost/1c09f262' type='groupchat' from='[email protected]/joy'><body>aaaaa</body><delay xmlns='urn:xmpp:delay' stamp='2012-10-22T01:22:22.176Z' from='[email protected]/joy'/><x xmlns='jabber:x:delay' stamp='20121022T01:22:22' from='[email protected]/joy'/></message><message xmlns='jabber:client' to='joynleo@localhost/1c09f262' type='groupchat' from='[email protected]/joy'><body>aa</body><delay xmlns='urn:xmpp:delay' stamp='2012-10-22T02:01:23.187Z' from='[email protected]/joy'/><x xmlns='jabber:x:delay' stamp='20121022T02:01:23' from='[email protected]/joy'/></message><message xmlns='jabber:client' to='joynleo@localhost/1c09f262' type='groupchat' from='[email protected]/joy'><body>adfa</body><delay xmlns='urn:xmpp:delay' stamp='2012-10-22T02:01:28.173Z' from='[email protected]/joy'/><x xmlns='jabber:x:delay' stamp='20121022T02:01:28' from='[email protected]/joy'/></message><message xmlns='jabber:client' to='joynleo@localhost/1c09f262' type='groupchat' from='[email protected]/joy'><body>adf</body><delay xmlns='urn:xmpp:delay' stamp='2012-10-22T02:01:34.202Z' from='[email protected]/joy'/><x xmlns='jabber:x:delay' stamp='20121022T02:01:34' from='[email protected]/joy'/></message><message xmlns='jabber:client' to='joynleo@localhost/1c09f262' type='groupchat' from='[email protected]/joy'><body>this </body><delay xmlns='urn:xmpp:delay' stamp='2012-10-22T02:01:40.230Z' from='[email protected]/joy'/><x xmlns='jabber:x:delay' stamp='20121022T02:01:40' from='[email protected]/joy'/></message><message xmlns='jabber:client' to='joynleo@localhost/1c09f262' type='groupchat' from='[email protected]/joy'><body>hi</body><delay xmlns='urn:xmpp:delay' stamp='2012-10-22T02:01:46.175Z' from='[email protected]/joy'/><x xmlns='jabber:x:delay' stamp='20121022T02:01:46' from='[email protected]/joy'/></message><message xmlns='jabber:client' to='joynleo@localhost/1c09f262' type='groupchat' from='[email protected]/joy'><body>wow</body><delay xmlns='urn:xmpp:delay' stamp='2012-10-22T02:02:04.232Z' from='[email protected]/joy'/><x xmlns='jabber:x:delay' stamp='20121022T02:02:04' from='[email protected]/joy'/></message><message xmlns='jabber:client' to='joynleo@localhost/1c09f262' type='groupchat' from='[email protected]/joy'><body>^^</body><delay xmlns='urn:xmpp:delay' stamp='2012-10-22T02:02:14.178Z' from='[email protected]/joy'/><x xmlns='jabber:x:delay' stamp='20121022T02:02:14' from='[email protected]/joy'/></message><message xmlns='jabber:client' to='joynleo@localhost/1c09f262' type='groupchat' from='[email protected]/joy'><body>oops</body><delay xmlns='urn:xmpp:delay' stamp='2012-10-22T02:02:27.185Z' from='[email protected]/joy'/><x xmlns='jabber:x:delay' stamp='20121022T02:02:27' from='[email protected]/joy'/></message><message xmln
10-22 12:14:27.765: D/CordovaLog(29238): SENT: <body rid='82835755' xmlns='http://jabber.org/protocol/httpbind' sid='1c09f262'/>
10-22 12:14:57.855: D/CordovaLog(29238): RECV: <body xmlns='http://jabber.org/protocol/httpbind'/>
10-22 12:14:57.935: D/CordovaLog(29238): SENT: <body rid='82835756' xmlns='http://jabber.org/protocol/httpbind' sid='1c09f262'/>
10-22 12:14:57.950: D/CordovaLog(29238): RECV: <body xmlns='http://jabber.org/protocol/httpbind' type='terminate' condition='policy-violation'/>
10-22 12:14:57.955: D/CordovaLog(29238): ##### Strophe.Status = CONNFAIL
10-22 12:14:57.975: D/CordovaLog(29238): SENT: <body rid='82835757' xmlns='http://jabber.org/protocol/httpbind' sid='1c09f262' type='terminate'><presence xmlns='jabber:client' type='unavailable'/></body>
10-22 12:15:01.065: D/CordovaLog(29238): ##### Strophe.Status = disconnected

finally i found the reason why client disconnected from server.
after i add openfire server property "xmpp.httpbind.client.requests.ignoreOveractiv ity" to true, everything is ok.
but client send too much request(over 10 time per second)
i wonder this trigger system overload.
is there any way to handle polling interval in strophe.js ?

Last edited by leo; October 22nd, 2012 at 04:03 AM..
 
Old October 22nd, 2012, 11:05 AM
Wrox Author
 
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts
Default

Strophe shouldn't be sending new polls except when openfire returns one. It sounds like for some reason you have gotten Openfire in poll-mode instead of long-polling mode. I suggest asking on the openfire group.
 
Old October 23rd, 2012, 11:08 PM
leo leo is offline
Registered User
 
Join Date: Oct 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default i tested my program different way

hi i tested my program different way right before

i added several server properties on openfire
1. xmpp.client.idle 360000
2. xmpp.httpbind.client.idle 360
3. xmpp.httpbind.client.requests.max 2
4. xmpp.httpbind.client.requests.polling 0
5. xmpp.httpbind.client.requests.wait 60

then i test two program simultaneously.
one is multi chatting(chap 8) on ie 8, it worked perfectly.

another one is also multi chatting(chap 8) on android device, i copied chap 8 source code to eclipse android project without any modify.
but after 30 seconds, server and client send/receive too much empty body http-bind message(<body xmlns='http://jabber.org/protocol/httpbind'/>)
i don't think this is openfire problem.
because i use same openfire server, same source code, but different platform.
and i wonder, have you ever tested on android device with strophe.js?
i need your help.
 
Old October 24th, 2012, 05:37 PM
Wrox Author
 
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts
Default

I have used it on android successfully. You might try sticking punjab in front of Openfire just to rule out the server completely.

The whole point of long polling is to have a request in flight. So if the server returns a long poll, we must send a new one. If it keeps returning them immediately, Strophe will keep sending them. Unless you are sending data, Strophe is only responding to the server long polls return. Or at least that is how it is supposed to work.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a room in MUC Purushotham BOOK: Professional XMPP Programming with JavaScript and jQuery 3 April 16th, 2012 05:06 PM
Error trying to export HelloWorld.apk to android device mdax BOOK: Beginning Android Application Development 1 January 12th, 2012 08:04 PM
Can't Creat an Android Virtual Device hrh212 BOOK: Beginning Android Tablet Application Development 1 August 11th, 2011 12:17 PM
MUC Issues jpeterson7755 BOOK: Professional XMPP Programming with JavaScript and jQuery 1 April 18th, 2011 07:39 PM
Android SDK/Android.bat does not find SWT.jar file chaoticandroid BOOK: Professional Android 2 Application Development 1 March 23rd, 2011 06:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.