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
{{ message }}
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
I am using faye rails but I believe that the same problem will be with private pub. Following the railscast the users can send messages to each other but I want to mark the messages as read when the recepient receives it. I added some ruby code on the partial because I thought that when the message is evaluated on the recipient wil be executed too. But it not working..
application.js:
$(function() {
var faye = new Faye.Client('http://xxxip/faye');
faye.subscribe('/messages/<%= @conversation.faye_token%>', function (data) {
eval(data);
});
});
create.js.erb:
<% broadcast "/messages/#{@conversation.faye_token}" do %>
$("#chat").append("<%= j(render('message', :message=> @message)) %>");
<% end %>
$('#message_body').val('');
and the partial I am rendering:
<%= message.body %> at <%= message.created_at.strftime("%H:%M, %d %b") %>
I am using faye rails but I believe that the same problem will be with private pub. Following the railscast the users can send messages to each other but I want to mark the messages as read when the recepient receives it. I added some ruby code on the partial because I thought that when the message is evaluated on the recipient wil be executed too. But it not working..
application.js:
$(function() {
var faye = new Faye.Client('http://xxxip/faye');
faye.subscribe('/messages/<%= @conversation.faye_token%>', function (data) {
eval(data);
});
});
create.js.erb:
<% broadcast "/messages/#{@conversation.faye_token}" do %>
$("#chat").append("<%= j(render('message', :message=> @message)) %>");
<% end %>
$('#message_body').val('');
and the partial I am rendering:
<%= message.body %> at <%= message.created_at.strftime("%H:%M, %d %b") %>
But the ruby code is executed on the recepient only if I reload the whole page.
The text was updated successfully, but these errors were encountered: