From 7c69f0a0bcb5874df3d7d0ba76d1016ff78112cb Mon Sep 17 00:00:00 2001 From: BenClaw Date: Sun, 17 May 2026 19:27:30 +0200 Subject: [PATCH] fix(action_cable): accept both /user/123 and /user_123 channel formats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- lib/mozo/broadcaster/action_cable.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/mozo/broadcaster/action_cable.rb b/lib/mozo/broadcaster/action_cable.rb index 2331490c..66bb43da 100644 --- a/lib/mozo/broadcaster/action_cable.rb +++ b/lib/mozo/broadcaster/action_cable.rb @@ -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_ - # /supplier/:sid → supplier_ + # 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)