Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

how to put php and node.js togther

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?

Problem courtesy of: user192344

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.

Solution courtesy of: ThomasReggi

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

how to put php and node.js togther

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×