I tried to integrate node js with my application, I have just test the http server It works well, but when I use https server as following with my index.php to subscribe the message, This does not work.
Start a server
var https = require('https'),
faye = require('faye');
var fs = require('fs');
var options = {
key: fs.readFileSync('/etc/apache2/ssl/apache.key'),
cert: fs.readFileSync('/etc/apache2/ssl/apache.crt')
};
var server = https.createServer(options),
bayeux = new faye.NodeAdapter({mount: '/'});
bayeux.attach(server);
server.listen(1337);
Create a client
<script src="faye-browser-min.js"></script>
<script>
var client = new Faye.Client('https://localhost:1337/');
client.subscribe('/messages/*', function(message) {
alert('Got a message:');
});
</script>
Send messages
I used Faye client to push message in test.php .
$adapter = new \Nc\FayeClient\Adapter\CurlAdapter();
$client = new \Nc\FayeClient\Client($adapter, 'https://localhost:1337/');
$client->send("/messages/test", array("name" => "foo"), array("token" => "456454sdqd"));
Thank you,
Please tell me how to check is there any error on server side.
I fixed issue my self, The issue was not in server side. It was in php Faye Client side. That Php Client works fine for HTTP server, but I need to use it for HTTPS server. I have done following changes then It works fine.
/vendor/nc/faye-client/src/Nc/FayeClient/Adapter/CurlAdapter.php