Skip to content

Conversation

Goldtean
Copy link

This fixes the issue of having a message appear in all chatrooms. Created a different name for each stream based on the chatroom's id which is inside of a hidden field in the message partial. If you like this solution, please follow me or star some of my projects! Thanks!

$("#messages").removeClass('hidden');
return $('#messages').append(this.renderMessage(data));
},
chatroom_id: function(data) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we need this chatroom_id function?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote this code a long time ago but I believe it's needed to identify the chatroom.

Copy link

@TImPDaley TImPDaley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice Job... I was struggling on the best way to fix this... and yours is clean. Thank you.

NaokiIshimura added a commit to NaokiIshimura/action-cable-example that referenced this pull request Apr 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants