You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using streams to send notification between two applications. The applications are communicating through clusters via redis. Whenever, I push some notification from one app to another, it does not work. But when I refresh the browsers and try, it works.
Can u please tell me what is the problem. My code goes as follows:
App 1 code
function sendMessage(message,date,toUserId,fromUserId,jobId){
ChatStream.emit(toUserId,message,date,toUserId,fromUserId,jobId);
}
ChatStream.on(Meteor.userId(),function(message,date,toUserId,fromUserId,jobId){
var formatDate = moment(date).fromNow();
var index = ClientChat.find().count();
var chatObj = {
from:fromUserId,
message:message,
date:formatDate,
jobId:jobId,
index:index
}
//ClientChat.insert({from:fromUserId,message:message,date:formatDate,jobId:jobId,index:index})
ClientChat.insert(chatObj);
Session.set('receivedPing',chatObj);
})
App2
function sendMessage(message,date,toUserId,fromUserId,jobId){
ChatStream.emit(toUserId,message,date,toUserId,fromUserId,jobId);
}
I am using streams to send notification between two applications. The applications are communicating through clusters via redis. Whenever, I push some notification from one app to another, it does not work. But when I refresh the browsers and try, it works.
Can u please tell me what is the problem. My code goes as follows:
App 1 code
function sendMessage(message,date,toUserId,fromUserId,jobId){
ChatStream.emit(toUserId,message,date,toUserId,fromUserId,jobId);
}
ChatStream.on(Meteor.userId(),function(message,date,toUserId,fromUserId,jobId){
var formatDate = moment(date).fromNow();
var index = ClientChat.find().count();
var chatObj = {
from:fromUserId,
message:message,
date:formatDate,
jobId:jobId,
index:index
}
//ClientChat.insert({from:fromUserId,message:message,date:formatDate,jobId:jobId,index:index})
ClientChat.insert(chatObj);
Session.set('receivedPing',chatObj);
})
App2
function sendMessage(message,date,toUserId,fromUserId,jobId){
ChatStream.emit(toUserId,message,date,toUserId,fromUserId,jobId);
}
ChatStream.on(Meteor.userId(),function(message,date,toUserId,fromUserId,jobId){
ClientChat.insert({from:fromUserId,message:message,date:date,jobId:jobId})
})
Cluster.js in server folder
Meteor.startup(function(){
Meteor.Cluster.init();
Meteor.Cluster.sync(ChatStream,LocalNotificationStream);
})
lib folder
ChatStream = new Meteor.Stream('chatStream');
The text was updated successfully, but these errors were encountered: