how to put php and node.js togther
Problem
I have test node.js + socket.io with port 8080 yesterday
i found that the frontend page which receive the data and send request must defined as HTML
which mean, i can use a mvc php combine with node.js and socket.io
is there any way to do that?
more if i define the node server as localhost:8080 i cant call the web server by other place, such as localhost
unlike nature websocket, i can use the socket anywhere, and i just need to define the socket address as localhost:8080
anyway to solve out?
Solution
Run node on port 8080 run php on port 8081. Use php to run your frontend HTML and JavaScript include the frontend socket.io library and connect to localhost:8080 (the node server)
// client side code
var socket = io.connect('http://localhost:8080');
This is untested, and I don't know if this is what you want, or if it will work.
Discussion
View additional discussion.