Sha256: eb146a64fc3e57c7689d0df93b6e9e1dfbb1b89250bb2b7e140a5831ece39ad9

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

module ActionCable
  module Helpers
    module ActionCableHelper
      # Returns an "action-cable-url" meta tag with the value of the url specified in your
      # configuration. Ensure this is above your javascript tag:
      #
      #   <head>
      #     <%= action_cable_meta_tag %>
      #     <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
      #   </head>
      #
      # This is then used by ActionCable to determine the url of your websocket server.
      # Your CoffeeScript can then connect to the server without needing to specify the
      # url directly:
      #
      #   #= require cable
      #   @App = {}
      #   App.cable = Cable.createConsumer()
      #
      # Make sure to specify the correct server location in each of your environments
      # config file:
      #
      #   config.action_cable.url = "ws://example.com:28080"
      def action_cable_meta_tag
        tag "meta", name: "action-cable-url", content: Rails.application.config.action_cable.url
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
actioncable-5.0.0.beta2 lib/action_cable/helpers/action_cable_helper.rb
actioncable-5.0.0.beta1.1 lib/action_cable/helpers/action_cable_helper.rb
actioncable-5.0.0.beta1 lib/action_cable/helpers/action_cable_helper.rb