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 August 5th, 2010, 08:26 AM
Registered User
 
Join Date: Aug 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can't connect to bosh.metajack nor my own server :(

hi,

I read ~75% of the book and think its an excellent book, very clear yet powerful stuff. Thank you Jack for writing this book!

However today I tried running the examples and failed miserably :(
I am running my own XMPP server (Openfire). It has an http binding feature, and emite (GWT XMPP lib+client) connect to it just fine.

I tried chapter 4 example (Peek) but it doesn't connect. I am pretty new to javascript and web programming in general, but looks to me like bosh.metajack.im:5280/xmpp-httpbind doesn't reply. It replies fine to the browser.

I see there is another thread with this issue and its unresolved there, so I figured instead of connecting to bosh.metajack I'd connect to my server directly.
I changed the connection url to my machine, and I get an error from flXHR (seen thanks to firebug)
flXHR::onreadystatechange(): Error, An error occurred in the handler function. (xml.tagName is undefined)

The error message is cryptic and didn't give me much to work on, but I figured I don't need flXHR because I can host the webpage from the same machine that runs the xmpp server. So I removed the flXHR imports from the html.

Now I don't have any errors in firebug, but it still doesn't connect. Looking at the Net tab, under XHR I see 3 attempts to http bind, all have status "200 aborted".

What am I doing wrong?

I am using
JID Iftah@127.0.0.1 (I tried also just Iftah)
Server http://127.0.0.1:7070 (the openfire http binding)

as I said I can connect using another XMPP javascript client (emite).

thanks in advance,
Iftah.
 
Old August 9th, 2010, 06:50 AM
Registered User
 
Join Date: Aug 2010
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok turns out I misunderstood the javascript Same Origin Policy. It does not apply just to the server IP or domain, but also to the port.

I was running the javascript files with a simple python web server on one port and the xmpp server on the same machine but different port (of course).

The way to set it up is to make the web server proxy the requests of a certain url to the other server. As described here http://www.malcollier.com/?p=14 or here http://www.pheedcontent.com/click.ph...cc834be5b76f77.
I'll setup apache webserver and set it and see if I can finally play with the book examples with my own server.

When I tried running the Emite chat I did not run it with the python webserver but from within eclipse, and I guess they had their project setup to forward the url on the server side.
 
Old March 31st, 2013, 05:50 PM
Registered User
 
Join Date: Mar 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default xml.tagName is undefined

I had the same problem running the example in Chapter 4 (peek.html)
I was connecting to googletalk servers.
I discovered that googeltalk sends back a space character on a regular basis, and the first one was sent before connection. This caused pretty_xml function to choke because the xml passed to the function did not have a tagName property.

I fixed it by checking for the tagName property, and just returning if it did not exist:
Code:
    	if (typeof(xml.tagName) == 'undefined' ) {
    		return "";
    	}
 
Old March 31st, 2013, 09:50 PM
Wrox Author
 
Join Date: Jan 2010
Posts: 178
Thanks: 0
Thanked 16 Times in 15 Posts
Default

A better fix would be to check the node type and ignore anything but element nodes.

Feel free to submit this via pull request on github, or just file a bug:
https://github.com/metajack/strophejs





Similar Threads
Thread Thread Starter Forum Replies Last Post
BOSH connection manager obratu BOOK: Professional XMPP Programming with JavaScript and jQuery 10 January 17th, 2011 04:10 PM
How to Connect to server ? dipchet C# 0 October 18th, 2007 03:12 AM
How to connect to SQL SERVER Wizard VB Databases Basics 1 February 5th, 2005 11:29 AM
can't connect to remote server alyeng2000 ASP.NET 1.0 and 1.1 Basics 4 February 9th, 2004 11:24 AM
[000] Unable to connect to server 'SERVER\SQL'; SQ ctanchan SQL Server 2000 1 August 15th, 2003 07:18 AM





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