Is it possible to make a POST request from "php" to "node.js+socket.io" and calling the appropriate method?
Code of server:
var io = require('socket.io').listen(8080);
io.sockets.on('connection', function (socket) {
socket.on('test', function (data) {
console.log(data);
});
socket.on('disconnect', function () {
console.log(socket.id);
});
});
How to call the method "test" from php?
It is possible to use fsockopen and perhaps even file_get_contents with a stream_context_create applied. But elephant.io seems to be a better solution: http://elephant.io/#usage
You'll want to create a socket on php to connect to your node.js server. Please see http://php.net/manual/de/function.fsockopen.php