Skip to content

Commit

Permalink
HBW-263 Get socket url from props
Browse files Browse the repository at this point in the history
  • Loading branch information
GideonEXE authored and hydra-billing-robot committed Jan 21, 2020
1 parent 3804e6c commit dcfd48d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Gemfile
Expand Up @@ -44,7 +44,6 @@ group :development do
gem 'rails_layout'
gem 'spring-commands-rspec'
gem 'ruby_parser'
gem 'puma'
end

group :development, :test, :staging do
Expand All @@ -61,6 +60,10 @@ group :development, :test, :staging do
gem 'rspec_junit_formatter'
end

group :development, :test do
gem 'puma'
end

group :production, :staging do
gem 'unicorn'
end
Expand Down
Expand Up @@ -75,7 +75,12 @@ const withStoreContext = (WrappedComponent) => {
};

initSocket = () => {
const ws = ActionCable.createConsumer('ws://127.0.0.1:3000/widget/cable');
const { host, protocol } = new URL(this.props.env.connection.serverURL);
const socketUrl = protocol === 'https:'
? `wss://${host}/widget/cable`
: `ws://${host}/widget/cable`;

const ws = ActionCable.createConsumer(socketUrl);
ws.subscriptions.create({ channel: 'TaskChannel' }, {
connected: () => {
console.log('Connected!');
Expand Down
1 change: 1 addition & 0 deletions run_tests.sh
Expand Up @@ -9,6 +9,7 @@ NODE_ENV=test
cp config/bpm.yml.sample config/bpm.yml
cp config/database.yml.sample config/database.yml
cp config/secrets.yml.sample config/secrets.yml
cp config/cable.yml.sample config/cable.yml
echo "sources:
bpmanagementsystem:
type: 'static/bpm'
Expand Down
2 changes: 1 addition & 1 deletion spec/support/capybara.rb
Expand Up @@ -40,4 +40,4 @@
"screenshot_#{example.full_description.gsub(' ', '-').gsub(/^.*\/spec\//,'')}"
end
Capybara.default_max_wait_time = 10
Capybara.server = :webrick
Capybara.server = :puma

0 comments on commit dcfd48d

Please sign in to comment.