Skip to content

Commit

Permalink
Change configuration for ActionCable
Browse files Browse the repository at this point in the history
  • Loading branch information
justin808 committed Feb 15, 2017
1 parent 4d0dc2d commit b62e5e6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/cable.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Action Cable uses Redis by default to administer connections, channels, and sending/receiving messages over the WebSocket.
production:
adapter: redis
url: <%= ENV["REDISCLOUD_URL"] %>
url: <%= ENV["REDIS_URL"] %>

development:
adapter: redis
Expand Down
27 changes: 24 additions & 3 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@

class ChatActionCable
def initialize(app, options={})
@app = app
end

def call(env)
if Faye::WebSocket.websocket?(env)
ActionCable.server.call(env)
else
@app.call(env)
end
end
end

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

Expand Down Expand Up @@ -38,9 +53,6 @@
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX

# Action Cable endpoint configuration
# config.action_cable.url = 'wss://example.com/cable'

# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true

Expand Down Expand Up @@ -85,4 +97,13 @@

# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false

# Action Cable endpoint configuration
config.action_cable.url = 'wss://www.reactrails.com/cable'
config.action_cable.allowed_request_origins = ['https://www.reactrails.com', 'http://www.reactrails.com']





end

0 comments on commit b62e5e6

Please sign in to comment.