Himanshu G.

Joined

60 Experience
0 Lessons Completed
0 Questions Solved

Activity

I have an inbuilt chat service on my application. A signed in user will select another user to start a conversation with them. How can I send stream for this new conversation to the 2 users without making them refetch subscriptions?
The only way it works as of now is re-subscribing to the conversations channel (refreshing the page emulates this).

def subscribed 
 conversations = current_user.conversations
 conversations.each do |conversation|
  stream_from "conversations:#{conversation.id}"
 end
end

This is the subscribed function I have. Whenever a user creates a new conversation current_user.conversations will change but to stream from the new conversation the subscription needs to be reset. Any ideas on a workaround ?

Posted in Passenger vs Puma

Hi. I have an inbuilt chat functionalty on my application that utlises websockets. My server freezes up very often and I can't figure out what config is best suited for my app.
https://github.com/phusion/passenger/wiki/Puma-vs-Phusion-Passenger talks about puma vs phusion-passenger. I have inferred my app will need multithreading (message relay jobs) hence I'm rolling back to puma which I had changed to phusion-passenger due to the same problem earlier. Am I addressing the problem here ? What do you think ?

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

© 2020 GoRails, LLC. All rights reserved.