I have a slight problem, trying to upload Laravel + Socket.io + Redis real time chat to DigitalOcean but since Node.js is using different port I can't figure it out how to manage it.
Maybe someone could put me on track by giving some kind of instruction or tutorial how to upload project to DigitalOcean where Laravel and Node.js are running simultaneously?
Using this tutorial:
laracasts.com/discuss/channels/general-discussion…
with Taylor's server.js example (found in Laravel Docs):
var app = require('http').createServer(handler);
var io = require('socket.io')(app);
var Redis = require('ioredis');
var redis = new Redis();
app.listen(6001, function() {
console.log('Server is running!');
});
function handler(req, res) {
res.writeHead(200);
res.end('');
}
io.on('connection', function(socket) {
//
});
redis.psubscribe('*', function(err, count) {
//
});
redis.on('pmessage', function(subscribed, channel, message) {
message = JSON.parse(message);
io.emit(channel + ':' + message.event, message.data);
});
you should do fine!
What do you mean by "Node.js is using different port"? Are you referring to your .js file you created to setup/run your socket.io server?
Vytautas Sakalauskas
PHP, Laravel, Redis