Reputation: 3088
Trying to setup an example for node.js chat on Windows x64.
Command line:
D:\Websites\dev\chat>node server.js
Server at http://127.0.0.1:8001/
Now when server part runs, trying http://dev/chat/index.html
After submitting Name, it gives me "error connecting to server".
Same error message on http://chat.nodejs.org/
Does the thing actually work? =)
Do I need to set up an Apache's mod_proxy to handle /join to port 8001?
Upvotes: 0
Views: 137
Reputation: 123453
Some of the issues are with using http://dev/chat/index.html
and also, I suspect, with:
Do I need to set up an Apache's mod_proxy to handle /join to port 8001?
Node's http
module is more for creating the server than it is for integrating with other servers like Apache. (It's possible, e.g. iisnode, but not the default.)
While node server.js
is running, you should be able to access index.html
via either:
http://localhost:8001/
http://127.0.0.1:8001/
Then, /join
, /recv
, /send
, etc. should be able to route through the same origin.
Otherwise, using http://dev/
has 2 problems:
Requests will route based on the current address. For example, /join
will request http://dev/join
rather than http://127.0.0.1:8001/join
, likely resulting in a 404
response. And, even if you modified the client script to specify the origin...
Same-origin policy. Pages requested from http://dev/
cannot make Ajax requests to http://127.0.0.1:8001
without exceptions, which this demo does not have established.
Upvotes: 1