ActionCable:为什么将广播放在单独的工作中?对于为什么不从控制器广播的表格? [英] ActionCable: Why put broadcasts in a separate job? For forms why not broadcast from controllers?
问题描述
大部分的教程是在一年前推出的DHH示例应用程序的版本略有更改。他们中的大多数人都喜欢将广播投入工作。但是A)这不是Redis的一点吗? B)由于我使用Delayed :: Job不会直接播放更快?
Most of the tutorials out there are slightly altered versions of an example app DHH put out over a year ago. Most of them share the habit of moving broadcasting out into a job. But A) Isn't that the point of Redis already? B) Since I'm using Delayed::Job wouldn't it just be faster to broadcast directly?
创建模型或通过ActionCable提交表单时,它不会似乎没有CSRF保护。是否积极限制起源消除了对protect_from_forgery的需求?宝石的自述文件有一个教程的链接,它添加了一个签名的cookie,我看到另一个教程 found_verified_user
从 warden ['env']。
。这是否解决了 protect_from_forgery
解决的问题?
When creating a model, or submitting a form through ActionCable it doesn't seem to have CSRF protection. Does actively restricting the origins eliminate the need for protect_from_forgery? The gem's Readme has a link to a tutorial which adds a signed cookie, and I saw another tutorial which finds_verified_user
from warden['env'].user
. Does this address the problem that protect_from_forgery
solves?
如果没有:我以为我可以将表单提交给控制器,然后直接从控制器广播给所有订阅的用户?但是,由于它看起来很简单,但是我没有看到任何我担心的地方有一些理由。有没有?
And if not: I thought I could submit the form to the controller as usual and then broadcast to all the subscribed users direct from the controller?But since it seems so simple but I haven't seen that anywhere I'm worried there's some reason. Is there?
推荐答案
只要能够给这个问题一个答案,这里是一个Heroku教程,使用我想要的相同的建筑理念使用。所以,从设计的角度来看,它似乎不再是反模式了。
Just to be able to give this question an answer here's a Heroku tutorial using the same architectural idea that I want to use. So, from a design standpoint it doesn't seem like an anti-pattern anymore
这篇关于ActionCable:为什么将广播放在单独的工作中?对于为什么不从控制器广播的表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!