pace icon indicating copy to clipboard operation
pace copied to clipboard

Breaking Rails ActionCable websockets

Open neohunter opened this issue 8 years ago • 1 comments

I'm not sure if this is the best place to report this.

I've a rails testing application I was using to learn about websockets using ActionCable. It was not working if I used pace, I tried with different versions and also the version on master.

If i modify the pace.coffee script setting trackWebSockets to false, the ActionCable works.

ajax:
    # Should we track web socket connections?
    trackWebSockets: false

If it's set to true, ActionCable does not work (the connection is established but the client never subscribe to the channel.

neohunter avatar May 09 '17 22:05 neohunter

The problem is that pace.js overrides window.WebSocket. https://github.com/HubSpot/pace/blob/4afddfb37aec45cc8588a91416fe28ca173314a8/pace.coffee#L365

Which ActionCable will use it directly. https://github.com/rails/rails/blob/739f88e52ec9d673e23f41545d55626351ce24eb/actioncable/app/assets/javascripts/action_cable.js#L7

wuboy0307 avatar Oct 09 '19 07:10 wuboy0307