Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 22nd, 2010, 07:33 PM
Registered User
 
Join Date: Nov 2010
Posts: 4
Thanks: 0
Thanked 3 Times in 3 Posts
Default BOSH, Strophe, and Openfire

First of all, your book is great. The examples work when hitting against your BOSH connection manager - http://bosh.metajack.im:5280/xmpp-httpbind

However, I wanted to take the next step and hit against a locally (desktop) installed instance of Openfire, using their Built-In connection manager.
I enabled the following with HTTP Bindings Settings on port 7070:
Clients can connect to this server using HTTP binding.
Allows BOSH clients with limited access to connect to the server

In the simple hello.js example I changed Strophe.Connection("http://bosh.metajack.im:5280/xmpp-httpbind")
to
Strophe.Connection("http://<local-machine>:7070/http-bind")

I can created some sample users and connect via Pidgin just fine. However, when I run the sample Hello app, it just hangs, not seeming to connect.

In Firebug console it is showing error 302 aborted

I am using Spring Source Tool Suite as an IDE for my hello application, which in turn fires up a local instance of Tomcat. Any ideas what I am doing wrong?

Thanks.

Last edited by iowadeifan; November 22nd, 2010 at 07:41 PM.
Reply With Quote
The Following User Says Thank You to iowadeifan For This Useful Post:
sheetal (April 30th, 2013)
  #2 (permalink)  
Old November 22nd, 2010, 07: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 15 Times in 14 Posts
Default

Quote:
Originally Posted by iowadeifan View Post
First of all, your book is great.
Thanks! I'm glad you like it.

Quote:
In the simple hello.js example I changed Strophe.Connection("http://bosh.metajack.im:5280/xmpp-httpbind")
to
Strophe.Connection("http://<local-machine>:7070/http-bind")
Openfire is unique in that it requires you to use a trailing slash on the http-bind resource. Try:

Strophe.Connection("http://<local-machine>:7070/http-bind/")

Let me know if that does or doesn't help.
Reply With Quote
The Following User Says Thank You to metajack For This Useful Post:
sheetal (April 30th, 2013)
  #3 (permalink)  
Old November 23rd, 2010, 09:44 AM
Registered User
 
Join Date: Nov 2010
Posts: 4
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I added the trailing slash
Code:
var conn = new Strophe.Connection("http://d68dfzk1-lt:7070/http-bind/");
and now I am getting different error showing up in Firebug

200 Aborted

XML Parsing Error: no element found Location: moz-nullprincipal:{8eead87c-3f20-427a-8ead-e5d8d2791768} Line Number 1, Column 1:

The post looks like this:
Code:
<body rid='321575070' xmlns='http://jabber.org/protocol/httpbind' to='d68dfzk1-lt' xml:lang='en' wait='60' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/>
Any ideas?

Thanks again.
Reply With Quote
The Following User Says Thank You to iowadeifan For This Useful Post:
sheetal (April 30th, 2013)
  #4 (permalink)  
Old November 23rd, 2010, 11:14 AM
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 15 Times in 14 Posts
Default

Quote:
and now I am getting different error showing up in Firebug

200 Aborted

XML Parsing Error: no element found Location: moz-nullprincipal:{8eead87c-3f20-427a-8ead-e5d8d2791768} Line Number 1, Column 1:
This looks like something is going wrong within the browser. Does it work if you disable firebug or if you turn Firebug's "Show XMLHttpRequests" option off in the Console tab (use the little arrow right next to the word 'Console').

I often find that Firebug and recent Firefox's break this particular functionality, and it has to be shut off for it to work correctly.

If that doesn't fix it, can you tell me some more information about your set up? Are you using CORS or flXHR? What is the URL of the page hosting hello.html (ie, is this a cross domain request)?
Reply With Quote
The Following User Says Thank You to metajack For This Useful Post:
sheetal (April 30th, 2013)
  #5 (permalink)  
Old November 23rd, 2010, 12:32 PM
Registered User
 
Join Date: Nov 2010
Posts: 4
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I am using flXHR. It is literally the exact hello example out of your book, with the only change 1 line of code to switch the pointer to a different connection manager.

http://d68dfzk1-lt:8089/app/hello.html is running from my local machine trying to access

http://d68dfzk1-lt:7070/http-bind/ from a local install of Openfire on the same machine.

It works against yours, but fails against mine. Is there something else I need to enable in Openfire?

Also, it seems to fail in IE, Chrome, and Firefox.

Thanks again for your help.
Reply With Quote
The Following User Says Thank You to iowadeifan For This Useful Post:
sheetal (April 30th, 2013)
  #6 (permalink)  
Old November 23rd, 2010, 05:57 PM
Registered User
 
Join Date: Nov 2010
Posts: 4
Thanks: 0
Thanked 3 Times in 3 Posts
Default

So I have gotten a little farther. If I use Apache to serve up the web pages locally, the client can talk to my local connection manager just fine. It is just when I run the html through my IDE which in turn is running tomcat that the client has issues communicating with my local connection manager.

In the end, I hope to build a Java web app that can talk to my back end as well as do messaging/presence from the client to client using Strophe and XMPP.

Still stumped, but at least a little progress....

Last edited by iowadeifan; November 23rd, 2010 at 05:59 PM.
Reply With Quote
  #7 (permalink)  
Old December 5th, 2010, 07:06 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 15 Times in 14 Posts
Default

Quote:
Originally Posted by iowadeifan View Post
So I have gotten a little farther. If I use Apache to serve up the web pages locally, the client can talk to my local connection manager just fine. It is just when I run the html through my IDE which in turn is running tomcat that the client has issues communicating with my local connection manager.
That's very odd. The only thing I can think of is that it is setting the wrong mimetype for the Flash file or something. Once the code is all loaded, there is no difference where it is running from (as long as it's running from an http:// URL). So I suspect that one of the components isn't loading correctly.

Perhaps use curl to check the mimetypes of a few different kinds of files and see if they look ok?
Reply With Quote
The Following User Says Thank You to metajack For This Useful Post:
sheetal (April 30th, 2013)
  #8 (permalink)  
Old April 22nd, 2011, 04:00 AM
Registered User
 
Join Date: Apr 2011
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
Default

You can try on with:

- var conn = new Strophe.Connection('/xmpp-httpbind');

If you work with Apache Server, go to apache\conf\extra\httpd-proxy.conf to add some configurations as follow:

ProxyRequests Off
ProxyPass /xmpp-httpbind http://127.0.0.1:7070/http-bind/
ProxyPassReverse /xmpp-httpbind http://127.0.0.1:7070/http-bind/
Reply With Quote
The Following User Says Thank You to CHOU Dimang For This Useful Post:
sheetal (April 30th, 2013)
  #9 (permalink)  
Old August 29th, 2011, 02:14 AM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi~

Just got this book and i can't seem to display the text in the sample program in Chapter 3 - Saying Hello:The First Application.

I use Apache for my local server and downloaded the necessary libraries but still can't get "Connection established." to be displayed.

Am I missing something. Please help me out on this.

Thank you...
Reply With Quote
  #10 (permalink)  
Old February 5th, 2012, 06:48 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 15 Times in 14 Posts
Default

Without more info I won't be able to help you. What browser are you using? What's the URL of hello.html in your browser when you get this problem? What errors do you see in the JavaScript console?
Reply With Quote
Reply


Thread Tools
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
Can't connect to bosh.metajack nor my own server :( Iftah BOOK: Professional XMPP Programming with JavaScript and jQuery 3 March 31st, 2013 09:50 PM
BOSH connection manager obratu BOOK: Professional XMPP Programming with JavaScript and jQuery 10 January 17th, 2011 03:10 PM
Using sha1 passwords in Strophe.js semper BOOK: Professional XMPP Programming with JavaScript and jQuery 1 June 28th, 2010 02:15 PM



All times are GMT -4. The time now is 10:40 AM.


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