我在Node.js和socket.io方面缺乏经验,因此可能会问一些愚蠢的问题,首先对此致歉。
我正在尝试完成以下内容:
- Installed node on ubuntu where I have apache also installed.
Created virtual host in apache and set it as proxy to node. My conf file looks like:
<VirtualHost *:80> ServerAdmin giorgi@omedia.ge ServerName node.aidemo.info ServerAlias www.node.aidemo.info ProxyRequests off <Proxy *> Order deny,allow Allow from all </Proxy> <Location /> ProxyPass http://127.0.0.1:8080 ProxyPassReverse http://127.0.0.1:8080 </Location> </VirtualHost>
Have created simple js file for server (first server example in socket.io website) and started server from cli with command: node server.js. It starts perfectly and listens to 8080
Created another virtualhost where I put clientside index.html (also from first example in socket.io). At first I had problem (and actually main problem is this), browser couldn't resolve path /socket.io/socket.io.js. Then I went to the url (http://localhost:8080/socket.io/socket.io.js) from lynx locally from terminal, downloaded that js and put locally with virtualhost near index.html. After this, browser could resolve that request, but I have error when socket.io.js itself is trying to get the url:
http://localhost:8080/socket.io/1/?t=1347623348836
你有什么想法可以解决这个问题吗? 我的主要目标是拥有一个web url,通过它可以访问我的node服务器,并使用socket.io与其通信 - 例如创建非常简单的聊天。
我希望我表达清楚了。 谢谢所有尝试帮助我的人。