Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 15th, 2011, 01:28 AM
Authorized User
 
Join Date: Jan 2011
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default presence without jquery

i get the following error "StropheError message: Cannot queue non-DOMElement." when i construct the presence message without using jquery and send it. any reason why?

thanks.

var Connection_ = null;
function Connect()
{
Connection_ = new Strophe.Connection('http://localhost:5280/xmpp-httpbind');

Connection_.connect(user, pwd, XMPP_ConnectionHandler);
}


function XMPP_ConnectionHandler(status)
{
if (status === Strophe.Status.CONNECTED)
{
var presence = "<presence>";
presence += " <priority>-1</priority>";
presence += "</presence>";
Connection_.send(presence);
}

}
  #2 (permalink)  
Old January 17th, 2011, 01:52 PM
Wrox Author
Points: 702, Level: 10
Points: 702, Level: 10 Points: 702, Level: 10 Points: 702, Level: 10
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts
Default

You cannot pass arbitrary strings to send(). They must be DOM elements. You can use Strophe's xmlElement() function to generate these if you like, or use the Strophe builder stuff.

For example:

Code:
Connection_.send($presence().c('priority').t(1));
would do the same thing your code is trying to do.

If you want to see how these DOM elements are built behind the scenes, you can look at the strophe.js source.
  #3 (permalink)  
Old January 17th, 2011, 08:20 PM
Authorized User
 
Join Date: Jan 2011
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i was just playing around with a things and found that

$presence().c('priority').t(1) and the string that i have on the code above is the exact same string and yet did produce the same result.

i did some digging of strophe source code and saw the initialization that happen when the $<> code is called.

thanks for answering the post. feels very good that there is someone to look out for when i need help...
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem getting the online presence list after attaching anamaria BOOK: Professional XMPP Programming with JavaScript and jQuery 2 December 5th, 2010 01:24 PM
Dealing with the presence of an XML tag rather tha Mike250 SQL Server 2005 1 June 6th, 2008 03:50 PM
How to Test for Presence of a File BrianWren Visual Basic 2005 Basics 7 April 30th, 2008 05:44 PM
Testing for presence of a variable rushman XSLT 2 September 12th, 2007 10:36 AM
How to check for the presence of an attribute dsekar_nat XSLT 2 July 27th, 2006 05:04 AM



All times are GMT -4. The time now is 06:38 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.