I have an app that can pass notification using node.js and redis on Laravel framework. It works good on local but when I deploy it on staging server it is not working. Please help me.
This is my server.js on root_folder/nodejs/server.js
var app = require('express')();
var http = require('http');
var server = require('http').Server(app);
var io = require('socket.io')(server);
var redis = require('redis');
// Check if server is listening on its port
server.listen(8890, 'my_ip_address_on_live', function() {
console.log('Listening on your port');
});
io.on('connection', function (socket) {
console.log("new client connected");
var redisClient = redis.createClient();
redisClient.subscribe('notification-channel', function(err, count) {
});
redisClient.on("message", function(channel, message) {
console.log( " message= "+ message + " channel = " + channel);
socket.emit(channel, message);
});
socket.on('disconnect', function() {
redisClient.quit();
});
});
On staging in will log only:
Listening on your port
And I think the problem is the socket cant connect because it does not log "new client connected". This is my first time using nodejs. Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire