S
S
Sergey Prosvirnin2014-03-17 11:53:13
PHP
Sergey Prosvirnin, 2014-03-17 11:53:13

How to pass data from node.js to php?

We make a game for contact. php+flash. As well as node.js as a comet server for chat and more. To transfer data, I found 3 options:
1. Make an http request from node.js to php
2. Run a separate process in the form of a php script that will listen to data either via a tcp socket or via redis pub/sub. Moreover, in this script, it will still be necessary to initiate the framework in order to use the already existing model architecture.
3. Just like in option 2, just run the php script via cron.
The question is, which method is better to choose, or maybe there are others?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew, 2014-03-17
@kaasius

Depends on what you need. Is it possible to do everything in a node? php is needed in several threads or in one? The second option looks great by the way.

A
Andrey Degtyaruk, 2014-03-17
@hlogeon

@sprosvirnin It's not entirely clear then, why do you need nodeJS if php is going to run in 1 thread? The maximum throughput is determined by the bottleneck of the channel, your PHP nodes are likely to be much narrower. You have there, as I understand it, all the logic and models.
On the topic of the question: it seems to me the most logical option is with http requests. This is how services work. You will not depend on the architecture, you will be able to easily transfer parts of the application to different servers, etc. The only thing is that it might make sense to think about websocket, but I don’t know anything about this topic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question