node.js - juggernaut file serving -
I'm developing real time notifier
As you know, when Customer Connect, Jarjournut serves files in its public directory, so processing is like this:
(1) Connect browser 8080 port (juggernaut listening port)
(2) Get JunkNet connection request, And the socket connection is complete.
(3) Send Joggerot Client HTML file which is its public directory, (4) The browser receives HTML and JS files from Jargonot, and starts communicating with Jargonot.
It works well in my server, it's Linux console. [Jinbom @ localhost gojug] # juggernaut 2 Sep 17:38:53 - socket.io Ready - Accepting Connections 2 Sep 17:38:57 - Service / - OK 2 September 17:38:57 - Servicing / Jason.JS - OK 2 Sep. 17:38:57 - Servicing / JunkNote.JS - OK 2 September 17:38:57 - Servicing / Socket_Oeges - OK 2 September 17:38: 57 - Service / WebShotman .swf - OK < / Pre>
In the browser you can see the connected result.
But, I do not want html and js files from juggernaut That's the web server I have, and integrate files with my PHP project files. In the main page, I have included the associated radar code. This is my main one. PHP page snippet
& lt; Script src = "http://myhost.org/json.js" type = "text / javascript" charset = "utf-8" & gt; & Lt; / Script & gt; & Lt; Script src = "http://myhost.org/socket_io.js" type = "text / javascript" charset = "UTF-8" & gt; & Lt; / Script & gt; & Lt; Script src = "http://myhost.org/juggernaut.js" type = "text / javascript" charset = "utf-8" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" charset = "UTF-8" & gt; Var Log Element = document.getElementById ("Log"); LogElement.value = ""; Var log = function (data) {logElement.value + = (data + "\ n"); }; Var jug = new Juggernaut ({secure: ('https:' == document.location.protocol), host: document.location.hostname, port: document.location.port || 80}); Jug.on ("connect", function () {log ("connected")}; Jug.on ("disconnected", function () {log ("disconnected")}); Jug.on ("reconnect", function () {log ("reconnect")}); Log ("Subscribe to Channel 1"); Jug.subscribe ("channel1", function (data) {log ("data received:" + data);}); // debugging window.jug = for the world; & Lt; / Script & gt; I just integrate Jagranot's public directory files into my client PHP files.
When I try to do this, the browser can not connect to the net. I think this is socket.io error (firebug console)
"network error: 404 not found - http://myhost.org:8080/socket.io/1/?t = 1314949832960 & jsonp = 0 " Is this wrong? So I have to keep them in the public directory and they will have to get it from the root cause?
I resolved it
original:
& Lt; Script src = "http://myhost.org /socket_io.js" type = "text / javascript" charset = "UTF-8" & gt; & Lt; / Script & gt; & Lt; Script src = "http://myhost.org/juggernaut.js" type = "text / javascript" charset = "utf-8" & gt; & Lt; / Script & gt;
fixed:
& lt; Script src = "http://myhost.org:8080/socket_io.js" type = "text / javascript" charset = "utf-8" & gt; & Lt; / Script & gt; & Lt; Script src = "http://myhost.org:8080/juggernaut.js" type = "text / javascript" charset = "UTF-8" & gt; & Lt; / Script & gt; So far, I do not understand why this fixing fixes this problem, works well ~ ^ ^; Hope for this help.
Comments
Post a Comment