Open willc0de4food opened 8 years ago
Hey :)
Well, I found a clean solution to this problem: Somewhere in the wrapper, add an input including your current_user id
<input type="hidden" value="<%= current_user.id %>" name="sender-id" id="senderid">
Then, in your js publish, retrieve it, and voila :)
<% publish_to whatever_you_want do %>
sender = $('#senderid').val();
if (sender == "<%= current_user.id %>") {
// do your stuff
}
<% end %>
I just got private chat working with private pub, but am having trouble differentiating between the sender and recipient of a message. When the message is published to the recipient, the sender class is applied to the message (the same problem that this user is having: http://stackoverflow.com/questions/35989728/differentiate-users-with-private-pub )
Is there a solution to this problem that I missed?
Thanks