actioncable

Deploying Rails with ActionCable to AWS Elastic Beanstalk using ALB

蓝咒 提交于 2019-12-11 06:38:53
问题 I'm trying to deploy a Rails 5.1.4 application to AWS Elastic Beanstalk and cannot get ActionCable to work. There appears to be a problem with upgrading the HTTP connection to a WebSocket, as per the Rails logs: I, [2017-11-29T20:53:23.533734 #6275] INFO -- : [014bad33-65a1-489e-9108-dc4157965491] Started GET "/cable" for 24.192.57.23 at 2017-11-29 20:53:23 +0000 I, [2017-11-29T20:53:23.534481 #6275] INFO -- : [014bad33-65a1-489e-9108-dc4157965491] Started GET "/cable/"[non-WebSocket] for 24

With ActionCable, is there a way to count how many subscribers from inside a channel?

房东的猫 提交于 2019-12-11 01:44:17
问题 For an app I'm building, I have a "lobby" page where people configure which area they'd like to join. Pretty basic. I'd like to have a running total of active consumers that are currently subscribed to the channel for this page, so that users know whether or not there's other people around to interact with. Is there an easy way to do this? 回答1: I defined a helper method: app/channels/application_cable/channel.rb module ApplicationCable class Channel < ActionCable::Channel::Base def

Rails5 Action Cable Nginx 404 and 502 errors

醉酒当歌 提交于 2019-12-10 23:35:18
问题 Everyone :). I know people have already faced alot of problems related to mine. I have tried all but my issue has not been resolved. I have been working from past 3 days to fix this but I am unable to do it. I am using ActionCable for the first time and on development server it is working fine. But in production where I am using Puma and Nginx I am facing terrible issues. Initially when I had not (location /cable) settings in nginx configuration, server gives me 404 handshake error i.e Error

Can a Rails 5 application with ActionCable be deployed on Windows?

微笑、不失礼 提交于 2019-12-10 23:21:56
问题 I have a Rails 5 application which I was planning to deploy on Linux, but because we needed some access very specific Windows-only software, I need to deploy it on Windows Server 2012 R2. My software stack (or mix) was supposed to be Nginx/Puma/Rails/PostgreSQL/Redis. Everything installs for me on Windows except Puma, and the Rails documentation says that I need Puma for ActionCable. How do I get Puma to run on Windows? I have seen and tried snippets of things to try, and I have also seen and

What is Ruby on Rails Action Cable adapter?

本小妞迷上赌 提交于 2019-12-10 19:13:55
问题 looking through RoR action cable guide http://edgeguides.rubyonrails.org/action_cable_overview.html#subscription-adapter , didn't found much information about action cable adapter. development: adapter: async test: adapter: async production: adapter: redis url: redis://10.10.3.153:6381 Could you explain what is async adapter and why do I need redis in production as adapter? 回答1: Action Cable provides a subscription adapter interface to process its pubsub internals. By default, asynchronous,

How to send the status of WebSocket request in ActionCable

痴心易碎 提交于 2019-12-10 16:35:40
问题 Is there any way to send a status of request to client in ActionCable Channels? For example, if sent data is invalid (or some unknown exception were raised) I want to error text in response message, otherwise send 'status: ok'. What I have on client side now is subscriber's perform method which returns true in almost any circumstances as we can see from source code (github): send: (data) -> if @isOpen() @webSocket.send(JSON.stringify(data)) true else false In websocket-rails gem there were

Subscription class not found 'MyChannel' in ActionCable

╄→гoц情女王★ 提交于 2019-12-08 19:32:28
问题 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 (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket) Subscription class not found: "ConversationChannel" Could not execute command from {"command"=>"message", "identifier"=>"{\"channel\":\"ConversationChannel\"}", "data"=>"{\"message\"

How to terminate subscription to an actioncable channel from server?

做~自己de王妃 提交于 2019-12-07 03:44:55
问题 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? 回答1: http://api.rubyonrails.org/classes/ActionCable/Channel/Base.html#class-ActionCable::Channel::Base-label-Rejecting+subscription+requests class ChatChannel < ApplicationCable::Channel def subscribed @room = Chat::Room[params[:room_number]] reject unless current_user.can_access?(@room) end

Deploying Ruby on Rails app to Heroku while using Action Cable (Puma port listening)

别来无恙 提交于 2019-12-06 07:08:07
问题 I have got Action Cable working in a local host environment and in this situation I start the Puma server using a simple file containing # /bin/bash bundle exec puma -p 28080 cable/config.ru Once this happens the puma server starts and is listening to this 28080 port and the port the local server is running on. Through hunting online I couldn't find a place that would tell me a way to emulate this on heroku or a way to have my server always start on the same port (though I don't know if that

What can be the reason of “Unable to find subscription with identifier” in Rails ActionCable?

时光总嘲笑我的痴心妄想 提交于 2019-12-06 02:51:09
问题 I'm building a messenger application using Rails 5.0.0.rc1 + ActionCable + Redis. I've single channel ApiChannel and a number of actions in it. There are some "unicast" actions -> ask for something, get something back, and "broadcast" actions -> do something, broadcast the payload to some connected clients. From time to time I'm getting RuntimeError exception from here: https://github.com/rails/rails/blob/master/actioncable/lib/action_cable/connection/subscriptions.rb#L70 Unable to find