I'm using laravel and redis for real time chat. I can fire event from my laravel and receiving that data to client side.
My problem is how can i send something from client and then receive it to redis and pass it to laravel
E.g How can i check if user has read the chat message.
Code :
var express = require('express');
var app = express();
var server = require('http').createServer(app);
var io = require( 'socket.io' ).listen( server );
var redis = require('redis');
var port = process.env.PORT || 8888;
server.listen(port,'x.x.x.x');
io.on('connection', function (socket) {
console.log("Connected");
});
var redisClient = redis.createClient();
redisClient.psubscribe(['get_message','read_message']);
redisClient.on("pmessage", function(channel, pattern, message) {
console.log(channel); // i can see get_message on this line in console but not read_message
});
//Also tried this
io.on('read_message', function (socket) {
console.log(socket);
});
//Also this
redisClient.on('read_message', function (socket) {
console.log(socket);
});
redisClient.on('disconnect', function() {
console.log("Disconnected");
redisClient.quit();
});
Note : I'm emitting data from IOS app.