Hi! Thank you for your incredibly valuable work! It's really awesome, especially for folk like me who are newbies in Rails! When I did all the steps according to this video, I noticed that if a user switches rooms his status turns to offline. I did a workaround (probably not the best one) in two lines: CONNECTION_PING_INTERVAL = 5.seconds periodically :appear, every: CONNECTION_PING_INTERVAL Maybe this comment will be of some help to someone 😂
Just a small hint: Since ES6 you can do this instead of building a for loop for the elements: Array.from(elements, element => element.classList.add("online")). You could also use the spread operator [...elements], but Array.from support a callback function!
What is the difference using between ` ` and ' ' in this line `user-${data.user_id}-status` --the add/remove online not work with ' '. I don't really like how works right now the online offline, right now in my example only appears if you add new message, but not in the old ones, i will watch the next episodes to see if something i forget to do. Saludos.
When you enter channel at 25:15 it shows that 'Flying-intern' is offline. And it keeps that status until actual 'Flying-intern' do not refresh the page. Plus if that new user refresh page after getting new updated status of being online, he loss it again :( Any idea what to do?
Hi Artur! I'm going to take a look at this and make another update video. I noticed mine wasn't working perfectly either. There may need to be a stronger backend implementation to keep track of who is active. I'm going to think on it a bit :)
And I added this code to our room_channel.js to scroll our chat down after sending a message. let messages = $(".chat-room"); messages.scrollTop(messages[0].scrollHeight); But I had to install jquery to make it go. Could you help me with refactoring it to pure JS? Thanks!
Hi! Thank you for your incredibly valuable work! It's really awesome, especially for folk like me who are newbies in Rails!
When I did all the steps according to this video, I noticed that if a user switches rooms his status turns to offline. I did a workaround (probably not the best one) in two lines:
CONNECTION_PING_INTERVAL = 5.seconds
periodically :appear, every: CONNECTION_PING_INTERVAL
Maybe this comment will be of some help to someone 😂
Are you planning on returning to ruby on rails now that rails 7 is here. Your channels is one of the good ones
Just a small hint: Since ES6 you can do this instead of building a for loop for the elements: Array.from(elements, element => element.classList.add("online")). You could also use the spread operator [...elements], but Array.from support a callback function!
Great tutorial! thank you!
Glad you enjoyed it!
What is the difference using between ` ` and ' ' in this line `user-${data.user_id}-status` --the add/remove online not work with ' '. I don't really like how works right now the online offline, right now in my example only appears if you add new message, but not in the old ones, i will watch the next episodes to see if something i forget to do. Saludos.
👏🏼👏🏼👏🏼 thank you!
Sure thing! Glad you are enjoying the videos!
When you enter channel at 25:15 it shows that 'Flying-intern' is offline. And it keeps that status until actual 'Flying-intern' do not refresh the page. Plus if that new user refresh page after getting new updated status of being online, he loss it again :( Any idea what to do?
Hi Artur! I'm going to take a look at this and make another update video. I noticed mine wasn't working perfectly either. There may need to be a stronger backend implementation to keep track of who is active. I'm going to think on it a bit :)
And I added this code to our room_channel.js to scroll our chat down after sending a message.
let messages = $(".chat-room");
messages.scrollTop(messages[0].scrollHeight);
But I had to install jquery to make it go. Could you help me with refactoring it to pure JS? Thanks!
Nice! I'll see about adding a pure JS version.