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
0
votes
1 answer

Rails ActionCable "connected" method not being called

I'm trying to use ActionCable in my Rails project, and while it seems that the WebSocket connection is being established no messages are being sent (only pings). As far as I can tell the connected method in my CoffeeScript is never called. This is…
megahra
  • 295
  • 2
  • 19
0
votes
1 answer

Rails 5 ActionCable modify confirm_subscription

I got this channel: class TestChannel < ApplicationCable::Channel def subscribed stream_from 'test' ActionCable.server.broadcast 'Test', vehicles: Vehice.find_by id: 13 end end I don't wanna broadcast to all subscriber when someone…
bonekost
  • 57
  • 9
0
votes
1 answer

Rails 5 Actioncable - failed: Error during WebSocket handshake: Unexpected response code: 502

I am trying to use ActionCable in rails 5 but i dont know why its not working. In browser console i receive: WebSocket connection to 'ws://my.website/cable' failed: WebSocket is closed before the connection is established. WebSocket connection to…
Navid Farjad
  • 435
  • 5
  • 16
0
votes
0 answers

Rails ActionCable Invalid frame header on production

I have an actioncable application, on development it works fine, but when and deploy to production on Amazon Web Service. I have this problem WebSocket connection to 'ws://www.mydomain.com/cable' failed: Invalid frame header My nginx configuration…
0
votes
1 answer

How to sign in second user in incognito window to test actioncable

I'm trying to sign in a 2nd user to see if ActionCable is working. I have my app open in a regular Chrome window on localhost:3000 and I also have it open in an incognito window also localhost:3000 From…
Leo Ku
  • 73
  • 2
  • 6
0
votes
1 answer

Action cable is working instead I push data

I'm currently learning actionable which is fantastic (instead of the errors). And I'm facing a weird problem. My goal is to build a channel for the groups creation. To permit the user to see new ones without a refresh. At this point, all is…
stig Garet
  • 564
  • 2
  • 13
0
votes
0 answers

ActionCable Coffeescript syntax

I am having an issue while trying to replicate Michael Hartl ActionCable tutorial https://www.learnenough.com/action-cable-tutorial (I have no knowledge in Coffeescript nor much in JS) Especially section 4.3 when author is altering…
Maxence
  • 2,029
  • 4
  • 18
  • 37
0
votes
1 answer

Rails How to use ActionCable to render whole new page on "received:"

I'm trying to make a quiz application (non single page app) with 2 user types and this use case: the quiz-hoster-user and the participant-users are on a "waiting page" until the quiz starts the quiz-hoster-user clicks on a "quiz start"-button to…
megahra
  • 295
  • 2
  • 19
0
votes
2 answers

Rails 5 error connecting to Redis on Heroku

Heroku returns error for connecting to Redis. I'm using Action Cable for a messaging site, which works FINE in local development. I'm using RedisToGo I added this to my production.rb: config.middleware.use…
Jacob Hixon
  • 133
  • 1
  • 9
0
votes
0 answers

Access controller methods from ActionCable

The example code from doc: # app/channels/web_notifications_channel.rb class WebNotificationsChannel < ApplicationCable::Channel def subscribed stream_for current_user end end I have method current_user in ApplicationController. There error…
fl-web
  • 462
  • 5
  • 16
0
votes
1 answer

Rails Actioncable - correct place for subscription?

I'm currently following the official Rails ActionCable guide. It suggests creating a file for the subscriptions (App.cable.subscriptions.create{...}) in app/assets/javascripts/cable/subscriptions/channelname.coffee - but when I use the command…
megahra
  • 295
  • 2
  • 19
0
votes
2 answers

Chat web app with Rails - page auto scroll when sending message

I just created a basic web chat application, the problem is that each time a user sends a message the page scrolls up automatically. That the page doesn't refresh when I send the message so it shouldn't scroll up. Any idea how to solve this…
BoB
  • 133
  • 1
  • 11
0
votes
1 answer

Rails 5 ActionCable setup and workflow

I am new to ActionCable and sockets and trying to implement some real time features. I successfully implemented real time notifications functionality (basic one) into my app, however there are a couple of things on which i spent some time to…
Rares R
  • 209
  • 1
  • 13
0
votes
1 answer

Action Cable: How to get the client's subscription name when the client unsubscribes?

I am implementing a chat in Rails 5 API Action Cable using Devise and gem 'devise_token_auth'. I have a ChatRequestChannel with parameterized subscriptions: stream_from "chat_request_#{chat_request_chanel_token}_channel" I need to somehow reliably…
prograils
  • 2,248
  • 1
  • 28
  • 45
0
votes
1 answer

Action Cable is not working with rails 5

I am a beginner in Rails 5 and I am trying to implement web sockets in my app. I am trying to copy and run a test app at first and I figure out it is not working as it is not transmitting and receiving the data. received: (data) -> is never called.…
Achilles
  • 250
  • 5
  • 13