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
7
votes
0 answers

action cable - not receiving response on client

When I run my react-native mobile app, the server says it connects to the PostChannel. It creates the post, however I get no response in the 'received' function so it does not update in real time. This is my react-native code: import ActionCable…
7
votes
2 answers

ActionCable not connecting during capybara-webkit feature spec

I have a problem using actioncable with feature specs using Capybara-webkit. Actioncable is working perfectly on my development server, but when testing the javascript cant seem to connect. This is the output from the javascript console which is…
7
votes
1 answer

Heroku Websocket to Custom Domain

I'm using ActionCable with Rails on Heroku. Chat works perfectly when I am at example.herokuapp.com BUT it breaks on my custom domain (example.com) because I am NOT issuing a cookie from the host of the web socket (wss://example.heroku.com/cable). …
Austin
  • 71
  • 1
7
votes
1 answer

ActionCable: close the connection manually from front-end

I can not close my socket manually. It quits only when I close a tab in the browser. Finished "/cable/" [WebSocket] for 127.0.0.1 at 2016-10-29 16:55:49 +0200 But when I call…
opla
  • 128
  • 7
7
votes
4 answers

How to terminate subscription to an actioncable channel from server?

Is there a way to terminate the subscription to a particular channel for any particular consumer from the server side (controller) so that disconnected callback in my coffee script file can be invoked?
7
votes
3 answers

Rails 5 - Action Cable - list of connected users

I'm starting with Rails 5 and Action Cable and I would like to display a list of names of all connected registered users (something like facebook's green circle). I managed to get the name of the user, but now I'm thinking what's the best way to…
dedekm
  • 93
  • 7
7
votes
3 answers

Rails actioncable alias request origins

I have an application with subdomains and I would like to be able to connect to a WebSocket of all of the subdomains when I add a subdomain to cable/config.ru ActionCable.server.config.allowed_request_origins = ["domain.com", "sub1.domain.com",…
Adrian
  • 532
  • 1
  • 7
  • 16
6
votes
0 answers

fetch request randomly hanging with react-native app

The other day, I noticed that some of the API calls from the app were silently not being executed. I logged out a console.log before and after a fetch request, and lo' and behold, the await on the fetch was never completing. // in an async js…
6
votes
1 answer

Find User for a JWT token in devise-jwt in rails

I am using devise-jwt for token based authentication in my RoR app. The client sends in a token in the header like so: Bearer #{token} By using authenticate_user! I am able to authenticate the user in the controller, and get the logged in user as…
Novneet Nov
  • 592
  • 1
  • 7
  • 22
6
votes
1 answer

Rails + ActionCable + Passenger + AWS Elasticache (Redis) : how to fix 'WebSocket is closed before the connection is established.' on production?

I have some troubles working my action cable in production environment. Development env is working fine. Error to solve : WebSocket connection to 'wss://myapp.com/cable' failed: WebSocket is closed before the connection is established. I'm getting…
Curdix
  • 113
  • 1
  • 4
6
votes
1 answer

Passenger uses more PostgreSQL connection than expected

Hard issue happening in production for a long time, we have no clue about where it's coming from. Can sometimes reproduces it on localhost, Heroku Enterprise support has been clue-less about this. On our production database, we currently have the…
Erowlin
  • 9,555
  • 4
  • 35
  • 63
6
votes
2 answers

ActionCable Rails 5 (Passenger) - failed: Error during WebSocket handshake: Unexpected response code: 404

I am trying to deploy ActionCable and Rails 5 To Production server (DigitalOcean). I have followed all steps mention in the Gorails video here: https://gorails.com/episodes/deploy-actioncable-and-rails-5 The app was deployed using Phusion Passenger…
6
votes
0 answers

Websockets with NGINX and Rails ActionCable

What is wrong with our configuration? NGINX is not adding the proper headers. Using React front end to initialize client with wss connection, received by AWS ELB, passed unencrypted to nginx, proxy_passed to Rails backend. React connection…
csi
  • 9,018
  • 8
  • 61
  • 81
6
votes
1 answer

Render Rails partial with data from action cable

I try to build a chat page with action cable. I successfully get the new message data like App.room = App.cable.subscriptions.create({ channel: "API::V1::TransactionMessageChannel", transaction_id: gon.transaction_id }, { connected:…
Ian Tran
  • 315
  • 3
  • 14
6
votes
1 answer

Rails 5 ActionCable App is not defined

I am new to ActionCable in Rails 5. I am trying to make a chat for my Rails app. When I try and send a test message through the console App.room.speak('Test!') but when I do I get an error. Uncaught ReferenceError: App is not defined at…
jrocc
  • 1,274
  • 2
  • 18
  • 48