File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change
1
+ * Add an ` identifier ` to the event payload for the ActiveSupport::Notification ` transmit_subscription_confirmation.action_cable ` and ` transmit_subscription_rejection.action_cable ` .
2
+
3
+ * Keith Schacht*
1
4
2
5
Please check [ 7-2-stable] ( https://github.com/rails/rails/blob/7-2-stable/actioncable/CHANGELOG.md ) for previous changes.
Original file line number Diff line number Diff line change @@ -309,7 +309,7 @@ def transmit_subscription_confirmation
309
309
unless subscription_confirmation_sent?
310
310
logger . debug "#{ self . class . name } is transmitting the subscription confirmation"
311
311
312
- ActiveSupport ::Notifications . instrument ( "transmit_subscription_confirmation.action_cable" , channel_class : self . class . name ) do
312
+ ActiveSupport ::Notifications . instrument ( "transmit_subscription_confirmation.action_cable" , channel_class : self . class . name , identifier : @identifier ) do
313
313
connection . transmit identifier : @identifier , type : ActionCable ::INTERNAL [ :message_types ] [ :confirmation ]
314
314
@subscription_confirmation_sent = true
315
315
end
@@ -324,7 +324,7 @@ def reject_subscription
324
324
def transmit_subscription_rejection
325
325
logger . debug "#{ self . class . name } is transmitting the subscription rejection"
326
326
327
- ActiveSupport ::Notifications . instrument ( "transmit_subscription_rejection.action_cable" , channel_class : self . class . name ) do
327
+ ActiveSupport ::Notifications . instrument ( "transmit_subscription_rejection.action_cable" , channel_class : self . class . name , identifier : @identifier ) do
328
328
connection . transmit identifier : @identifier , type : ActionCable ::INTERNAL [ :message_types ] [ :rejection ]
329
329
end
330
330
end
Original file line number Diff line number Diff line change @@ -242,6 +242,7 @@ def error_handler
242
242
assert_equal 1 , events . length
243
243
assert_equal "transmit_subscription_confirmation.action_cable" , events [ 0 ] . name
244
244
assert_equal "ActionCable::Channel::BaseTest::ChatChannel" , events [ 0 ] . payload [ :channel_class ]
245
+ assert_equal "{id: 1}" , events [ 0 ] . payload [ :identifier ]
245
246
end
246
247
ensure
247
248
ActiveSupport ::Notifications . unsubscribe "transmit_subscription_confirmation.action_cable"
@@ -256,6 +257,7 @@ def error_handler
256
257
assert_equal 1 , events . length
257
258
assert_equal "transmit_subscription_rejection.action_cable" , events [ 0 ] . name
258
259
assert_equal "ActionCable::Channel::BaseTest::ChatChannel" , events [ 0 ] . payload [ :channel_class ]
260
+ assert_equal "{id: 1}" , events [ 0 ] . payload [ :identifier ]
259
261
ensure
260
262
ActiveSupport ::Notifications . unsubscribe "transmit_subscription_rejection.action_cable"
261
263
end
You can’t perform that action at this time.
0 commit comments