module AnyCable::Rails::JWT::Helper
Public Instance Methods
action_cable_with_jwt_meta_tag(**identifiers)
click to toggle source
# File lib/anycable/rails/jwt/helper.rb, line 9 def action_cable_with_jwt_meta_tag(**identifiers) # From: https://github.com/rails/rails/blob/main/actioncable/lib/action_cable/helpers/action_cable_helper.rb base_url = ActionCable.server.config.url || ActionCable.server.config.mount_path || raise("No Action Cable URL configured -- please configure this at config.action_cable.url") token = JWT.encode(**identifiers) parts = [base_url, "#{AnyCable.config.jwt_id_param}=#{token}"] uri = URI.parse(base_url) url = parts.join(uri.query ? "&" : "?") tag "meta", name: "action-cable-url", content: url end
any_cable_jwt_meta_tag(**identifiers)
click to toggle source
# File lib/anycable/rails/jwt/helper.rb, line 26 def any_cable_jwt_meta_tag(**identifiers) token = JWT.encode(**identifiers) tag "meta", name: "any-cable-jwt", content: token end