Chris Valentine

Joined

240 Experience
1 Lesson Completed
0 Questions Solved

Activity

Posted in Multiuser Live Video Chat in Rails Discussion

Nice video. Will there be more on the other features you mentioned, such as recording, broadcasts, etc.?

Posted in Group Chat with ActionCable: Part 4 Discussion

renderer = ChatMessagesController.renderer.new(
  http_host: ENV['RAILS_APPLICATION_URL'].presence || 'http://localhost:3000' ,
  https:      Rails.env.production?
)

ActionCable.server.broadcast "stream:#{chat_message.stream.id}", {
    chat_message: renderer.render(chat_message)         
}

Had to set the host and ssl to get it to work, the defaults are going back to example.com . SSL was important to set right without it it did not work.

Posted in Send ActionCable broadcast from javascript

i realize this was just a $.ajax() call so it was taken care of. Thanks.

Posted in Send ActionCable broadcast from javascript

In the tutorials here, I've seen an ActionCable broadcast be initiated by a chat message save. The broadcast is sent via a relay to a background job and then the chatmessages on the clients update when that broadcast job is run.

In my app, i have a host that runs a chatroom. I'd like the host to click a button and have that button run a javascript command to tell ActionCable to send the "disable-chat" command to the clients that are in the host's chat. I know how the clients receive that message thru ActionCable but how can the host send that request. There is no database save going on and no form to submit.

I imagine in javascript on the hosts page there is something like . chat_consumer.send('chatroom.disable'); or something like that, without doing a form that submits the requests. How do I go about this? Thx

Posted in Group Chat with ActionCable: Part 4 Discussion

I tried this but the request.base_url is reporting as Http://example.org at that point. Hmm

Posted in Group Chat with ActionCable: Part 4 Discussion

This is the applicationhelper that is called

def profile_picture_with_class user, css_class, shape, width = 100
    if (shape == :square)
        placeholder_pic = "blank_profile_square.jpg"
    else
        placeholder_pic = "blank_profile_round.png"
    end
    image_path = user.profile_image.present? ? user.profile_image : placeholder_pic
    image_tag(image_path, width: width, class: css_class)
end 

Posted in Group Chat with ActionCable: Part 4 Discussion

tried to delete this extra comment but the 3 dot menu in the upper right is not working :(

Posted in Group Chat with ActionCable: Part 4 Discussion

Can you explain why I want actioncable running on the about page, the contact us page, or any page before there is even a user signed in? Seems a lot of unnecessary traffic processing when it will not be used. Say my site has 50 pages only 1 of which even uses actioncable. Thanks.

Posted in Group Chat with ActionCable: Part 4 Discussion

Thanks for the tutorial but I'm struggling with understanding some of the concepts. This tutorial (and everyone I can find online) seems to assume actioncable is to be loaded on every page on the site. Is there any direction on say you only want this stuff happening on the ChatPage. not the About US page or the Main page or before a user has signed in. I cannot find any guidance on turning this off/on only if you are on the correct page that will be using it. Thanks

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2021 GoRails, LLC. All rights reserved.