【发布时间】:2018-03-29 01:27:51
【问题描述】:
有什么方法可以将消息发送到频道,例如,
此命令从服务器发送到客户端
ActionCable.server.broadcast('test_notification_channel', {t: 1})
但我需要从控制器直接发送到频道
【问题讨论】:
有什么方法可以将消息发送到频道,例如,
此命令从服务器发送到客户端
ActionCable.server.broadcast('test_notification_channel', {t: 1})
但我需要从控制器直接发送到频道
【问题讨论】:
虽然我认为它可以通过其他方式完成,包括 action: 应该可以工作,假设您的频道有 stream_for "test_notification_channel"
ActionCable.server.broadcast \
"test_notification_channel", { action: "method_on_channel", t: "1" }
【讨论】: