Questions tagged [actioncable]

Action Cable is an open source technology shipped to us with Ruby On Rails 5. It uses websockets instead of traditional HTTP protocol and allows 2-way asynchronious data transfer. The best field of application for ActionCable is chat, single page applications and so on.

The Action Cable source is placed at Github.

To find code examples please check actioncable-examples repository.

849 questions
12
votes
1 answer

Rails 5 actioncable undefined method `fetch' for nil:NilClass

I am using Rails 5 with actioncable and I am getting this error when trying send anything that throws actioncable What should i do? I'm trying to push the project to Heroku. NoMethodError in MessagesController#create undefined method `fetch' for…
Adham El-Deeb
  • 335
  • 3
  • 16
11
votes
2 answers

How do I mock and verify an ActionCable transmission in minitest?

I'm using Ruby on Rails 5.1 with ActionCable. I would like to use minitest to test a particular method, and mock the "ActionCable.server.broadcast" call to verify I'm sending out the right data I have module MyModule class Scanner def…
Dave
  • 15,639
  • 133
  • 442
  • 830
11
votes
3 answers

Subscription class not found 'MyChannel' in ActionCable

I am facing a problem while working with Action Cable, whenever I run my program I receive an error that says Subscription Class not found ConversationChannel and when I try to send a message I get this log Successfully upgraded to WebSocket…
11
votes
3 answers

Action cable unable to connect (Failed to upgrade to WebSocket )

I am having a issue in connecting to websocket in non-development environments with these log messages Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: close, HTTP_UPGRADE: ) Finished "/cable/"[non-WebSocket] for 127.0.0.1 at…
sethi
  • 1,869
  • 2
  • 17
  • 27
11
votes
3 answers

How to configure ActionCable with Nginx and Unicorn in production?

I've recently switched my rails project from Rails4 to 5.0.0.beta3 to use the awesome ActionCable. My ActionCable server is run inside unicorn. In development all works fine. In production I have Started GET "/cable" for xxx.xxx.xxx.xxx at…
yzalavin
  • 1,788
  • 1
  • 13
  • 19
11
votes
2 answers

Rails 4 and ActionCable

I am building a real time chat into a rails 4 application. It seems ActionCable is the tool for this kind of job. Is it possible to use ActionCable in rails 4 or do I have update to rails 5? I cannot find any introduction for ActionCable with rails…
DenicioCode
  • 8,668
  • 4
  • 18
  • 33
10
votes
1 answer

Rails ActionCable on Puma and Nginx not working on production after deploy via capistrano

I create a website using ActionCable via Rails on top of Puma and Nginx on production. But after deploying to the Production server seems like ActionCable is not working because of this problem.WebSocket connection to WebSocket connection to…
Varis Darasirikul
  • 3,907
  • 9
  • 40
  • 75
10
votes
2 answers

How to set params when subscribing to Action Cable channel

I've been trying to get my head around action cable for what seems like months. Please help. I have a "Connection" - I can't set the identified_by :current_user because this endpoint also needs to be consumed by an external API that uses WebSockets.…
10
votes
2 answers

How can I call a channel method in a rails controller?

I have an ActionCable method that subscribes the user. If a new convo is started, I want to subscribe the user to the new channel as well. I can't figure out the proper syntax for calling a channel method in a controller. UPDATE: The issue is that…
gwalshington
  • 1,418
  • 2
  • 30
  • 60
10
votes
4 answers

action cable subscribing locally, but not on heroku

I've been trying everything I can find online, and nothing is working. Hoping some fresh eyes will see the issue. This is my first time using ActionCable, and everything works great locally, but when pushing to heroku. my logs do not show any…
gwalshington
  • 1,418
  • 2
  • 30
  • 60
10
votes
6 answers

How to close connection in Action cable?

How to disconnect a client in Action cable (rails 5)? I would like the user to be completely disconnected (similar to when he closes the tab).
10
votes
2 answers

Actioncable broadcasts not hitting Received JS function

I have been trying to get a rails app together to replace a nastily coded php monstrosity. The current incarnation is pulling data from a non-Rails db, putting it into the Rails db and then displaying it in the views. The db is mainly populated with…
Scaylos
  • 123
  • 1
  • 5
10
votes
2 answers

Ruby on Rails 5 Action Cable: stream for current model instance (URL-based subscriptions)

I have searched the web far and wide (including reading many code examples for ActionCable) for what seems to be an answer to a very basic question. Alas, I have not solved my problem. Suppose, I have a model Search and I have navigated to the URL…
Vadim
  • 1,916
  • 2
  • 19
  • 39
9
votes
1 answer

Broadcast to a User's Turbo Stream using Hotwire Rails

I want to stream model updates using Hotwire in Rails. In the documentation they mention creating a stream using a model but I want to create a dynamic stream per user so that changes to models done by a user are only streamed to that user. I have a…
Encore PTL
  • 8,084
  • 10
  • 43
  • 78
9
votes
1 answer

Using ActionCable with multiple identification methods

I develop a Ruby on Rails 5.1 application using ActionCable. User authentification via Devise works fine for several channels. Now, I want to add a second type of channels which does not require any user authentification. More precisely, I would…
Boris
  • 338
  • 2
  • 20
1 2
3
56 57