Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > BOOK: Professional XMPP Programming with JavaScript and jQuery
|
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 November 26th, 2012, 10:31 AM
Authorized User
 
Join Date: Nov 2012
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default presence type "unavailabe" called automaticaly:Please help

Hi Metajack,

Please help me, In my group chat suddenly receiving of messages stops , i debug and found the below things is called automatically and then it stops.

<presence xmlns='jabber:client'
type='unavailable'
from='[email protected]/8d7d54fb'
to='[email protected]/1e6281fe'/>
 
Old November 26th, 2012, 10:52 AM
Wrox Author
 
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts
Default

That means that the resource 8d7d54fb disconnected or set their presence unavailable.

Strophe does not do this automatically. If you aren't setting yourself unavailable, it means the xmpp connection was lost and the server is automatically informing you that resource has gone offline.
 
Old November 26th, 2012, 12:52 PM
Authorized User
 
Join Date: Nov 2012
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Metajack,

I am just using the JID and password and did not send any resource. Also what is the reason for lost xmpp connection please tell me how I will fix this error. Please help me.
 
Old November 26th, 2012, 12:58 PM
Wrox Author
 
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts
Default

The presence unavailable is not coming from you but from another connection. You can see that the from and to resources are different. The to one must be the one for this connection, so that means this stanza is being generated by another connection. It's possible that you refreshed the page or something and that is the old connection finally closing (if it wasn't disconnected cleanly it will hang around for ~2m).
 
Old November 26th, 2012, 01:13 PM
Authorized User
 
Join Date: Nov 2012
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Metajack,

I am using the codes that are in the example. Please tell me if there is any thing wrong.

$(document).bind('connected', function () {

Arthur.connection.addHandler(Arthur.handle_message ,null, "message", "chat");

Arthur.connection.addHandler(Arthur.on_public_mess age,
null, "message", "groupchat");
Arthur.connection.send($pres().c('priority').t('-1'));
Arthur.connection.send($pres());
Arthur.connection.addHandler(Arthur.on_presence,
null, "presence");
Arthur.connection.send(
$pres({
to: Arthur.room + "/" + Arthur.nickname
}).c('x', {xmlns: Arthur.NS_MUC}));
});


$(document).bind('disconnected', function () {
Arthur.connection = null;
});
 
Old November 26th, 2012, 01:16 PM
Wrox Author
 
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts
Default

I guess I don't understand what issue you are seeing. That presence message is perfectly normal and just means one of your other resources has gone offline. This is most likely caused by you reloading your example code which leaves the old XMPP connection in a zombie state. After a few minutes in a zombie state, the BOSH connection manager will close the connection and that presence message will be sent autoamtically by the server.

You can ignore this presence message entirely. It shouldn't affect your application at all.

If something bad is happening, it's probably going to be in the on_presence function, which will get called on all incoming presence messages.
 
Old November 26th, 2012, 01:56 PM
Authorized User
 
Join Date: Nov 2012
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Metajack,

I have no doubt where is that other resources coming from and also I am using example 08 so there will be no page reloading. Below is my connection code.

var conn = new Strophe.Connection('http://jonet.provident.nl/xmpp-httpbind');

var comparejid = '<?php echo $this->userName;?>';
comparejid = comparejid.toLowerCase();
var jid = comparejid+'@web06.provident.nl';
var pwd = 'openfire';
$('#hid_jid').val(jid);

//start set for public chat
Arthur.room = '[email protected]';
Arthur.nickname = comparejid;
//end set for public chat

Also how we can do multiple xmpp connection with two users in same page. Is that possible?

Thanks
 
Old November 26th, 2012, 01:57 PM
Wrox Author
 
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts
Default

Just create two connection objects, and connect them both.
 
Old November 26th, 2012, 02:08 PM
Authorized User
 
Join Date: Nov 2012
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am sending you the raw codes of group chat

<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>
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='DIGEST-MD5'/>
<challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
cmVhbG09IndlYjA2LnByb3ZpZGVudC5ubCIsbm9uY2U9IlVER3 hCbldNZWYxaGp3S1MzaVpvdFFvdDd0aDVSRllkcTUwZ2xaN2wi LHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bW Q1LXNlc3M=
</challenge>
<response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
dXNlcm5hbWU9ImthdXN0dWJoNDIwIixyZWFsbT0id2ViMDYucH JvdmlkZW50Lm5sIixub25jZT0iVURHeEJuV01lZjFoandLUzNp Wm90UW90N3RoNVJGWWRxNTBnbFo3bCIsY25vbmNlPSI1MWYxYz cwMzRjMmUwNmU1YjIyM2Y1MGExYzI4OTU5YyIsbmM9IjAwMDAw MDAxIixxb3A9ImF1dGgiLGRpZ2VzdC11cmk9InhtcHAvd2ViMD YucHJvdmlkZW50Lm5sIixyZXNwb25zZT0iZjE4OWU3NmJjZDJh OTYyODMwOGNlODBjNmVhNDcxMzEiLGNoYXJzZXQ9InV0Zi04Ig ==
</response>
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
cnNwYXV0aD05OGQwZjNiNzRjYTFmMDQ1MmVlZTY1NjIzYTFmMj IwYw==
</success>
<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>
<iq type='set'
id='_bind_auth_2'
xmlns='jabber:client'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
</iq>
<iq xmlns='jabber:client'
type='result'
id='_bind_auth_2'
to='web06.provident.nl/6b517963'>
<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'>
<jid>
[email protected]/6b517963
</jid>
</bind>
</iq>
<iq type='set'
id='_session_auth_2'
xmlns='jabber:client'>
<session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
</iq>
<iq xmlns='jabber:client'
type='result'
id='_session_auth_2'
to='[email protected]/6b517963'/>
<presence xmlns='jabber:client'>
<priority>
-1
</priority>
</presence>
<presence to='[email protected] l/kaustubh420'
xmlns='jabber:client'>
<x xmlns='http://jabber.org/protocol/muc'/>
</presence>
<presence xmlns='jabber:client'
from='[email protected]/cb533e06'
to='[email protected]/6b517963'>
<priority>
-1
</priority>
</presence>
<presence xmlns='jabber:client'
to='[email protected]/6b517963'
from='[email protected] .nl/kaustubh420'>
<x xmlns='http://jabber.org/protocol/muc#user'>
<item jid='[email protected]/6b517963'
affiliation='member'
role='participant'/>
</x>
</presence>
<message xmlns='jabber:client'
type='groupchat'
from='[email protected] .nl'
to='[email protected]/6b517963'>
<subject>
test
</subject>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T11:28:07.246Z'
from='[email protected] .nl'/>
<x xmlns='jabber:x:delay'
stamp='20121126T11:28:07'
from='[email protected] .nl'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='7:27'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
dd1
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T13:54:14.296Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T13:54:14'
from='[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='7:34'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
ff
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T14:01:40.284Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T14:01:40'
from='[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='7:35'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
hapina
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T14:02:44.486Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T14:02:44'
from='[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='7:39'
pname='KAUSTUBH420'
pid='8'
from='[email protected] .nl/kaustubh420'>
<body>
hh
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T14:06:46.727Z'
from='[email protected] .nl/kaustubh420'/>
<x xmlns='jabber:x:delay'
stamp='20121126T14:06:46'
from='[email protected] .nl/kaustubh420'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='7:48'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
jj
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T14:15:49.910Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T14:15:49'
from='[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='7:49'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
gg
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T14:16:19.893Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T14:16:19'
from='[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='7:49'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
hh
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T14:16:32.987Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T14:16:32'
from='[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='7:49'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
jj
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T14:16:44.895Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T14:16:44'
from='[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='7:50'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
op
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T14:17:45.892Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T14:17:45'
from='chr[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='7:51'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
hjhj
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T14:18:04.896Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T14:18:04'
from='[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='7:51'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
dfd
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T14:18:46.920Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T14:18:46'
from='[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='7:53'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
sffds
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T14:20:18.897Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T14:20:18'
from='[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='7:59'
pname='KAUSTUBH420'
pid='8'
from='[email protected] .nl/kaustubh420'>
<body>
fsfsdfd
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T14:26:44.209Z'
from='[email protected] .nl/kaustubh420'/>
<x xmlns='jabber:x:delay'
stamp='20121126T14:26:44'
from='[email protected] .nl/kaustubh420'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='8:12'
pname='KAUSTUBH420'
pid='8'
from='[email protected] .nl/kaustubh420'>
<body>
sadsadsad
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T14:39:05.426Z'
from='[email protected] .nl/kaustubh420'/>
<x xmlns='jabber:x:delay'
stamp='20121126T14:39:05'
from='[email protected] .nl/kaustubh420'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='8:13'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
dsfdf
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T14:40:53.081Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T14:40:53'
from='[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='10:41'
pname='KAUSTUBH420'
pid='8'
from='[email protected] .nl/kaustubh420'>
<body>
ko
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T17:11:08.845Z'
from='[email protected] .nl/kaustubh420'/>
<x xmlns='jabber:x:delay'
stamp='20121126T17:11:08'
from='[email protected] .nl/kaustubh420'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='10:41'
pname='KAUSTUBH420'
pid='8'
from='[email protected] .nl/kaustubh420'>
<body>
ll
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T17:11:22.937Z'
from='[email protected] .nl/kaustubh420'/>
<x xmlns='jabber:x:delay'
stamp='20121126T17:11:22'
from='[email protected] .nl/kaustubh420'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='10:44'
pname='KAUSTUBH420'
pid='8'
from='[email protected] .nl/kaustubh420'>
<body>
hi
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T17:14:36.849Z'
from='[email protected] .nl/kaustubh420'/>
<x xmlns='jabber:x:delay'
stamp='20121126T17:14:36'
from='[email protected] .nl/kaustubh420'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='10:47'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
gg
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T17:17:26.836Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T17:17:26'
from='[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='11:17'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
ll
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T17:47:50.857Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T17:47:50'
from='[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='11:18'
pname='KAUSTUBH420'
pid='8'
from='[email protected] .nl/kaustubh420'>
<body>
kk
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T17:48:13.023Z'
from='[email protected] .nl/kaustubh420'/>
<x xmlns='jabber:x:delay'
stamp='20121126T17:48:13'
from='[email protected] .nl/kaustubh420'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='11:27'
pname='KAUSTUBH420'
pid='8'
from='[email protected] .nl/kaustubh420'>
<body>
kk
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T17:57:39.898Z'
from='[email protected] .nl/kaustubh420'/>
<x xmlns='jabber:x:delay'
stamp='20121126T17:57:39'
from='[email protected] .nl/kaustubh420'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='11:29'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
hi gty
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T17:59:06.858Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T17:59:06'
from='[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='11:29'
pname='RESHU593'
pid='13'
from='[email protected] .nl/reshu593'>
<body>
shiva
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T17:59:17.804Z'
from='[email protected] .nl/reshu593'/>
<x xmlns='jabber:x:delay'
stamp='20121126T17:59:17'
from='[email protected] .nl/reshu593'/>
</message>
<message xmlns='jabber:client'
to='[email protected]/6b517963'
type='groupchat'
stamp='11:29'
pname='KAUSTUBH420'
pid='8'
from='[email protected] .nl/kaustubh420'>
<body>
hh
</body>
<delay xmlns='urn:xmpp:delay'
stamp='2012-11-26T17:59:53.236Z'
from='[email protected] .nl/kaustubh420'/>
<x xmlns='jabber:x:delay'
stamp='20121126T17:59:53'
from='[email protected] .nl/kaustubh420'/>
</message>
dd1
ff
hapina
hh
jj
gg
hh
jj
op
hjhj
dfd
sffds
fsfsdfd
sadsadsad
dsfdf
ko
ll
hi
gg
ll
kk
kk
hi gty
shiva
hh
<presence xmlns='jabber:client'
type='unavailable'
from='[email protected]/cb533e06'
to='[email protected]/6b517963'/>


After this points if I send any data it is not returning from the room

Please help me

Last edited by sudhansu; November 26th, 2012 at 02:23 PM..
 
Old November 26th, 2012, 02:28 PM
Authorized User
 
Join Date: Nov 2012
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Metajack,

I have highlighted the line for you to look. How I get rid of this other presence but I really I do not know if this is the problem or not. My problem is after certain time I am not able receive messages from room.

Thanks

Last edited by sudhansu; November 26th, 2012 at 03:29 PM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
"type" attribute in <script> tag Latinsteps BOOK: Beginning JavaScript 4th Edition 2 September 6th, 2011 01:29 AM
MSXSL gives error message for "for" inside "select" ilyaz XSLT 1 December 9th, 2010 05:02 PM
How to theme the "Browse" button of "FileUpload" control? varunbwj BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 14th, 2009 01:22 AM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM
Reading a files general property of "Type of file" GregSivers Visual Basic 2008 Essentials 7 June 3rd, 2009 09:38 AM





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