Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > BOOK: Professional XMPP Programming with JavaScript and jQuery
Password Reminder
Register
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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 28th, 2013, 05:04 PM
Authorized User
Points: 182, Level: 3
Points: 182, Level: 3 Points: 182, Level: 3 Points: 182, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2013
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default Failed to load resource scripts/signup.php

Up to now, I have been able to establish a connection to jabber with no qualms on the application I'm building. All of a sudden, I can't connect anymore and that problem has been persistent for over 24 hours now. I haven't changed any part of my code. When I checked the chrome error log for the hello script, I got the following error:

Failed to load resource scripts/signup.php

I'm not sure what that's supposed to mean since I don't even have a signup.php file in the scripts folder. This is the same scripts folder that contains the strophe and flxhr libraries. I do have a signup.php file in the server, but it is in no way connected to the hello.js script. When I click on the error string, it leads me to a page which displays a warning saying the webpage has a redireict loop. I'm confused

Maybe I should include my version of the hello files. Maybe someone can run them in their machine and see if they have they same problem. Thanks

php

PHP Code:


<!DOCTYPE html>
<
html>
  <
head>
    <
title>Hello Chapter 3</title>
    
    <
script type "text/javascript" src="http://code.jquery.com/jquery-latest.js"</script>



    <!--include JQM-->
    <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1"> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.0-rc.1/jquery.mobile-1.3.0-rc.1.min.css" />
    <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.0-rc.1/jquery.mobile-1.3.0-rc.1.min.js"></script>



    <!--include strophe and flxhr-->

    <script src='scripts/strophe.js'></script>
    <script src='scripts/flXHR.js'></script>




    <link rel='stylesheet' href='hello.css'>

    <script src='hello.js'></script>


  </head>
  <body>
    <h1>Hello</h1>

    <div id='log'>
    </div>

    <!-- login dialog -->
    <div id='login_dialog' class=''>
      <label>JID:</label><input type='text' id='jid' value = 'my_login_id@jabber.org'>
      <label>Password:</label><input type='password' id='password' value = 'my_password'>
      <button>Submit</button>
    </div>
  </body>
</html> 


js

PHP Code:

var Hello = {
    
connectionnull,
    
start_timenull,

    
log: function (msg) {
        $(
'#log').append("<p>" msg "</p>");
    },

    
send_ping: function (to) {
        var 
ping $iq({
            
toto,
            
type"get",
            
id"ping1"}).c("ping", {xmlns"urn:xmpp:ping"});

        
Hello.log("Sending ping to " to ".");

        
Hello.start_time = (new Date()).getTime();
        
Hello.connection.send(ping);
    },

    
handle_pong: function (iq) {
        var 
elapsed = (new Date()).getTime() - Hello.start_time;
        
Hello.log("Received pong from server in " elapsed "ms.");

        
Hello.connection.disconnect();
        
        return 
false;
    }
};

$(
document).ready(function () {

    $(
'#login_dialog button').click(function(){


        
Hello.log("connecting...");

                $(
document).trigger('connect', {
                    
jid: $('#jid').val(),
                    
password: $('#password').val()
                });        

    });

});

$(
document).bind('connect', function (evdata) {
    var 
conn = new Strophe.Connection(
        
"http://bosh.metajack.im:5280/xmpp-httpbind");

    
conn.connect(data.jiddata.password, function (status) {
        if (
status === Strophe.Status.CONNECTED) {
            $(
document).trigger('connected');
        } else if (
status === Strophe.Status.DISCONNECTED) {
            $(
document).trigger('disconnected');

        } else if (
status === Strophe.Status.CONNECTING) {
            
Hello.log("Attempting Connection");

        } else if (
status === Strophe.Status.AUTHENTICATING) {
            
Hello.log("Connection has been established.  Strophe is now attempting to authenticate and create a session");

        } else if (
status === Strophe.Status.CONNFAIL) {
            
Hello.log("Strophe encountered a problem trying to establish the connection");

        } else if (
status === Strophe.Status.AUTHFAIL) {
            
Hello.log("An error occured during the authentication process");
        }
    });

    
Hello.connection conn;
});

$(
document).bind('connected', function () {
    
// inform the user
    
Hello.log("Connection established.");



    
Hello.log("Full jid is: " Hello.connection.jid ".");

    
Hello.log("Domain is: " Strophe.getDomainFromJid(Hello.connection.jid) + ".");

    
Hello.log("Resource is: " Strophe.getResourceFromJid(Hello.connection.jid) + ".");

    
Hello.log("Bare jid is: " Strophe.getBareJidFromJid(Hello.connection.jid) + ".");

    
Hello.connection.addHandler(Hello.handle_pongnull"iq"null"ping1");

    var 
domain Strophe.getDomainFromJid(Hello.connection.jid);
    
    
Hello.send_ping(domain);

});

$(
document).bind('disconnected', function () {
    
Hello.log("Connection terminated.");

    
// remove dead connection object
    
Hello.connection null;
}); 


css

PHP Code:

body 
{
    
font-familyHelvetica;
}

h1 {
    
text-aligncenter;
}

.
hidden {
    
displaynone;
}

#log {
    
width:350px;height:400px;color:red;border:1px solid black;

  #2 (permalink)  
Old August 28th, 2013, 11:50 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

I don't see anything obvious in the code. I suspect something may have changed with your web server.

What url are you using to get to your hello app? At what point do you see this error? When loading the original HTML? Only after initiating a connection?
  #3 (permalink)  
Old August 29th, 2013, 12:54 AM
Authorized User
Points: 182, Level: 3
Points: 182, Level: 3 Points: 182, Level: 3 Points: 182, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2013
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Jack, I also suspect that my web server is at fault here. The URL is http://caffiage.com/ludo/hello.php

I get the error as soon as the page loads.
 


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
Dynamically adding HTML appears not to load scripts calimar Javascript 1 February 24th, 2011 01:04 PM
Unable to load the specified metadata resource. cuddling101 ASP.NET 4 General Discussion 3 December 12th, 2010 09:40 AM
load report failed zaghmout Crystal Reports 2 December 3rd, 2007 05:04 AM
Failed to get link in e-mail on signup Ajoy BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 15 August 26th, 2007 02:22 PM
How to load the scripts into sqlserver praveenps SQL Server 2000 1 April 6th, 2006 10:55 AM



All times are GMT -4. The time now is 03:48 AM.


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