fix(action_cable): accept both /user/123 and /user_123 channel formats

- Benjamin standardized on /user_123 in mozo.rb (underscore, no slash)
- Old remap regex ^/user/(.+)$ didn't match /user_123
- Fix: ^/user[/_](.+)$ accepts both separators → user_123
This commit is contained in:
BenClaw
2026-05-17 19:27:30 +02:00
parent 11ba8e7434
commit 7c69f0a0bc
+5 -5
View File
@@ -11,9 +11,9 @@ module Mozo
# - Integrated with Rails authentication (cookies, sessions)
# - WebSocket native (no long-polling fallback needed with modern browsers)
#
# Channel naming is kept compatible with the existing Faye convention:
# /user/:uid → user_<uid>
# /supplier/:sid → supplier_<sid>
# Channel naming: accepts both Faye format and underscore format:
# /user/123 or /user_123 user_123
# /supplier/456 or /supplier_456 supplier_456
#
# To use:
# Set Mozo.broadcaster = Mozo::Broadcaster::ActionCable.new
@@ -21,8 +21,8 @@ module Mozo
#
class ActionCable
CHANNEL_PREFIX_REMAP = {
%r{^/user/(.+)$} => 'user_\1',
%r{^/supplier/(.+)$} => 'supplier_\1'
%r{^/user[/_](.+)$} => 'user_\1',
%r{^/supplier[/_](.+)$} => 'supplier_\1'
}.freeze
def broadcast(message)