Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 9f32409

Browse files
authored
Merge pull request #6 from ruby-hyperloop/update_pusher
updates pusher config to allow cluster, updates to pusher 4 js
2 parents 1d9d191 + 3242355 commit 9f32409

File tree

3 files changed

+12
-94
lines changed

3 files changed

+12
-94
lines changed

lib/hyper-operation/transport/client_drivers.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def self.sync_dispatch(data)
121121
client_logging: Hyperloop.client_logging,
122122
pusher_fake_js: pusher_fake_js,
123123
key: Hyperloop.key,
124+
cluster: Hyperloop.cluster,
124125
encrypted: Hyperloop.encrypted,
125126
channel: Hyperloop.channel,
126127
form_authenticity_token: controller.send(:form_authenticity_token),
@@ -188,6 +189,7 @@ def self.initialize_client_drivers_on_boot
188189
%x{
189190
h = {
190191
encrypted: #{opts[:encrypted]},
192+
cluster: #{opts[:cluster]},
191193
authEndpoint: window.HyperloopEnginePath+'/hyperloop-pusher-auth',
192194
auth: {headers: {'X-CSRF-Token': #{opts[:form_authenticity_token]}}}
193195
};

lib/hyper-operation/transport/hyperloop.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ def self.secret
7474
opts[:secret] || Pusher.secret if transport == :pusher
7575
end
7676

77+
def self.cluster
78+
# mt1 is the default Pusher app cluster
79+
opts[:cluster] || 'mt1' if transport == :pusher
80+
end
81+
7782
def self.encrypted
7883
opts.key?(:encrypted) ? opts[:encrypted] : true
7984
end
@@ -125,7 +130,7 @@ def self.pusher
125130
raise '******** NO CHANNEL PREFIX SET ***************'
126131
end
127132
@pusher = Pusher::Client.new(
128-
opts || { app_id: app_id, key: key, secret: secret }
133+
opts || { app_id: app_id, key: key, secret: secret, cluster: cluster }
129134
)
130135
end
131136
@pusher

0 commit comments

Comments
 (0)