Answer the question
In order to leave comments, you need to log in
How to make php and nodejs friends?
Please tell me how can I transfer data from php to node.js and vice versa.
I was able to transfer data from php to the node using the elephant.io
project
But how back?
Answer the question
In order to leave comments, you need to log in
to be honest, I was even confused what to use. I will describe the problem, maybe there will be something specific:
I am writing a game portal where users can play checkers among themselves, for example. The entire site is implemented in Yii, and the games are in node.js. Now what does it all look like and what do I need.
For example, a user on the site creates an application for a game, 2 the user joins the application (here the yii powers end), then you need to transfer data about these users to node.js where the game will start.
I'm working with a mysql database so I don't think I need radish. For example, in node.js I pass the user_id of the users and the ticket id. Further, already on the node.js server using socket.io, I form a room for two players and they play. After the game is over, I need to send the data back to php , namely the information about the victory, after which php will calculate the rating and so on.
I was able to send data to node.js using http://elephant.io, and back with a simple post request. Everything works as it should, but will it be safe? Can they somehow intercept the data and replace it with their own? it will be a shame if the player loses and replaces the data in such a way that he is the winner.
Actually the task at me such and I to tell the truth was lost between variants.
you can open a tcp connection, a little code, and already a full-fledged data exchange, + adds the ability to "communicate" many programs, then bish is not dependent on any library, and it is realistic to implement a tcp client in any language.
I'm using redis and it has a subscription, etc. to events. Maybe
http://redis.io/commands#pubsub will work for you too
Can node.js write the information about the results to the database itself? So PHP will then be easier - just read it from there and display ...
so you need to give a signal to the node so that it starts working. I solved this with http://elephant.io/ and post back with a request.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question