跳至内容 跳至搜索
方法
A
B
O

实例公共方法

after_subscribe(*methods, &block)

此回调将在调用 Base#subscribed 方法后触发,即使订阅已通过 Base#reject 方法拒绝。

若仅在成功订阅时触发回调,请使用 Base#subscription_rejected? 方法

after_subscribe :my_method, unless: :subscription_rejected?
别名:on_subscribe
# File actioncable/lib/action_cable/channel/callbacks.rb, line 58
def after_subscribe(*methods, &block)
  set_callback(:subscribe, :after, *methods, &block)
end

after_unsubscribe(*methods, &block)

别名:on_unsubscribe
# File actioncable/lib/action_cable/channel/callbacks.rb, line 67
def after_unsubscribe(*methods, &block)
  set_callback(:unsubscribe, :after, *methods, &block)
end

before_subscribe(*methods, &block)

# File actioncable/lib/action_cable/channel/callbacks.rb, line 45
def before_subscribe(*methods, &block)
  set_callback(:subscribe, :before, *methods, &block)
end

before_unsubscribe(*methods, &block)

# File actioncable/lib/action_cable/channel/callbacks.rb, line 63
def before_unsubscribe(*methods, &block)
  set_callback(:unsubscribe, :before, *methods, &block)
end

on_subscribe(*methods, &block)

别名:after_subscribe

on_unsubscribe(*methods, &block)