Skip to content

Configure pusher

Anurag Tiwari edited this page Aug 11, 2019 · 1 revision

Install Pusher Gem

gem install pusher

Pusher initialization via initializer in Rails app

  # config/transaction.rb
  require 'pusher'
  PubsubClient = Pusher::Client.new(
    app_id:"app_id",
    key: "app_key",
    secret: "app_secret",
    cluster: "cluster_info",
    use_tls: true
  )

  Transaction.configure do |config|
    config.redis = Redis.new # defaults to localhost
    config.pubsub_client = {client: PubsubClient, trigger: 'trigger', channel_name: 'channel-1', event: 'task'}
  end

Pusher initialization directly

  # config/transaction.rb
  require 'pusher'
  PubsubClient = Pusher::Client.new(
    app_id:"app_id",
    key: "app_key",
    secret: "app_secret",
    cluster: "cluster_info",
    use_tls: true
  )

  Transaction.pubsub_client = {client: PubsubClient, trigger: 'trigger', channel_name: 'channel-1', event: 'task'}