Ruby on rails 我的ActionCable不传输数据
Ruby on rails 我的ActionCable不传输数据,ruby-on-rails,ruby,stream,actioncable,Ruby On Rails,Ruby,Stream,Actioncable,我对actioncable有问题。
我有两个通道Notification和Post,但只将通知流数据发送到received方法,而不是Post
PostChannel看起来像这样=>
类后通道
类PostBroadcastJobdef create
如果参数[:remotipart_已提交]
回应做某事|
@post=当前_user.posts.createpost_参数
@ma=邮政。matching@post.Heure,@post.Date,@post.type\u activite\u
我对actioncable有问题。
我有两个通道Notification和Post,但只将通知流数据发送到received方法,而不是Post
PostChannel看起来像这样=>
类后通道<应用程序表::通道
def订阅
来自post_频道_uu用户{current_user.id}
终止
def取消订阅
取消订阅频道时所需的任何清理
终止
终止
PostBroadcastJob看起来像这样=>
类PostBroadcastJob
我调用作业的位置如下=>def create
如果参数[:remotipart_已提交]
回应做某事|
@post=当前_user.posts.createpost_参数
@ma=邮政。matching@post.Heure,@post.Date,@post.type\u activite\u id.second
如果@ma.nil?
放奥肯火柴
其他的
匹配=@ma
PostBroadcastJob.perform_latermatch
终止
f、 html{重定向到用户\u URL当前用户}
f、 js
终止
其他的
闪光[危险]=noooooo
终止
结束
我的COFF文件看起来像这样=>`App.post=App.cable.subscriptions.create PostChannel,
已连接:->
当订阅准备在服务器上使用时调用
断开连接:->
当服务器终止订阅时调用
收到:匹配->
当此频道的websocket上有传入数据时调用
结果=>[ActiveJob]将NotificationBroadcastJob作业ID:59cf14ec-4f76-4b7d-af80-b0bcf6c65986排入Asyncdefault队列,参数为9,
通知加载0.0ms从通知中选择通知。*,其中notifications.id=?限度[[id,89],[LIMIT,1]]
Post Load 1.0ms选择Post.*从“2000-01-01 10:54:00 UTC”和“2000-01-01 12:54:00 UTC”之间且日期为“2017-06-27”且类型为“活动”\u id为“9”按Post排序的Post。是否在DESC限制下创建?抵消[[限制,1],[偏移,1]]
[ActiveJob][NotificationBroadcastJob][59cf14ec-4f76-4b7d-af80-b0bcf6c65986]使用参数9从Asyncdefault执行NotificationBroadcastJob,
[ActiveJob][NotificationBroadcastJob][59cf14ec-4f76-4b7d-af80-b0bcf6c65986]关系加载0.0ms从跟随者id=10的关系中选择跟随者id
渲染匹配/_match.html.erb 0.0ms
[ActionCable]向post_频道_用户_8:{:match=>kklklk}
[ActiveJob][NotificationBroadcastJob][59cf14ec-4f76-4b7d-af80-b0bcf6c65986]呈现通知/_counter.erb 4.0ms
[ActiveJob][NotificationBroadcastJob][59cf14ec-4f76-4b7d-af80-b0bcf6c65986]用户加载0.0ms从users.id=?限度[[id,10],[LIMIT,1]]
[ActiveJob][NotificationBroadcastJob][59cf14ec-4f76-4b7d-af80-b0bcf6c65986]呈现通知/_notification.html.erb 3.0ms
[ActiveJob][NotificationBroadcastJob][59cf14ec-4f76-4b7d-af80-b0bcf6c65986][ActionCable]向通知频道用户广播:{:计数器=>\n\n 9\n,:通知=>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}
[ActiveJob][NotificationBroadcastJob][59cf14ec-4f76-4b7d-af80-b0bcf6c65986]呈现通知/_counter.erb 85.0ms
渲染帖子/create.js.erb
[ActiveJob][NotificationBroadcastJob][59cf14ec-4f76-4b7d-af80-b0bcf6c65986]呈现通知/_notification.html.erb 0.0ms
[ActiveJob][NotificationBroadcastJob][59cf14ec-4f76-4b7d-af80-b0bcf6c65986][ActionCable]向通知频道用户广播:{:计数器=>\n\n 9\n,:通知=>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}
[ActiveJob][NotificationBroadcastJob][59cf14ec-4f76-4b7d-af80-b0bcf6c65986]在1075.4ms中从异步默认值执行NotificationBroadcastJob
NotificationsAnnel传输{counter=>\n\n 9\n,notification=>\n\nstream\u from post\u channel\uu用户{current\u user.id}
&
ActionCable.server.broadcast post_频道_用户{match.user_id}
谢谢你有时候当你专注的时候,我会忘记一些小事情:D
$('#notificationList').prepend "okok #{match}"`