how to reply message to the sender client with actioncable?
Use ActionCable::Connection::Base#transmit method
class BoardChannel < ApplicationCable::Channel
def subscribed
stream_from "board:#{params[:board]}"
end
def speak
result = do_something()
transmit(result) # send message to current connection (sender)
end
end
Send ActionCable to particular user
You should use a channel that's specific to that user. For example:
"notifications_channel_#{current_user.id}"
This is also documented in an example from the actioncable repo here: https://github.com/rails/rails/tree/master/actioncable#channel-example-2-receiving-new-web-notifications
What can be the reason of Unable to find subscription with identifier in Rails ActionCable?
It looks like it's related to this issue: https://github.com/rails/rails/issues/25381
Some kind of race conditions when Rails reply the subscription has been created but in fact it hasn't been done yet.
As a temporary solution adding a small timeout after establishing the subscription has solved the issue.
More investigation needs to be done, though.
Related Topics
Heroku: Pg::Connectionbad: Could Not Connect to Server: Connection Refused
How to Restart Rails from Within Rails
Normal Variables VS Instance Variable in Ruby, Whats the Difference
Fast Fuzzy/Approximate Search in Dictionary of Strings in Ruby
Are There "Rules" for Ruby Syntactic Sugar
Killing Process Group from Ruby Kills My Whole Computer
Failure to Install Old MySQL2 Gem
Terminal Not Executing Ruby Files
How to Use Factorygirl to Create an Attribute Called "Alias"
Factory_Girl + Rspec Doesn't Seem to Roll Back Changes After Each Example
Should Rbenv Be Installed System-Wide, or at a User Level
How to Extend a Class from an Initializer and Have It Reload in Development Environment
How to Programmatically Take Snapshot of Crawled Webpages (In Ruby)