How to debug problems with invalid frame headers using Rails / websocket-rails (stand-alone)

I'm starting with websocket-rails, trying to convert the old notification polling system (on Ruby 2.1 / Rails 4.0) into something more modern with WS. I use WebsocketRails in standalone mode, here is my configuration, basically by default:

WebsocketRails.setup do |config| config.standalone = true end 

I also installed the new Redis on the default port - there seems to be no transfer problems here.

On the client side, I added websocket-rails JS and when trying to open a connection and subscribe to the channel using:

  @dispatcher = new WebSocketRails "localhost:3001/websocket" @channel = @dispatcher.subscribe "notifications" 

I see an error on the Chrome console:

  WebSocket connection to 'ws://localhost:3001/websocket' failed: Invalid frame header 

In Firefox, the error is different, but still the error:

  The connection to ws://localhost:3001/websocket was interrupted while the page was loading. 

From the websocket server logs, I see that the connection was initiated and then deleted, but there are no other logs, even if the log level is "debug" ... There are no other errors that I can see and a quick Google search does not cause anything about an "invalid frame header "so I'm pretty stuck.

Any help would be appreciated!

EDIT: I ended up using NodeJS + Faye so that everything is in order and it works so well that I am pleased to introduce this new moving part to the system. I'm sure the problem was something temporary, based on my specific setup, but sometimes you just need to do everything.

+7
ruby ruby-on-rails websocket
source share
1 answer

I think you are looking for the following resources:

From the topic of the question: debugging websocket in google chrome

Chrome developers now have the ability to list WebSocket frames, as well as check data if the frames are not binary.

process:

  • Launch the Chrome Developer Tools.
  • Load your page and start WebSocket connections.
  • Click the Network tab.
  • Select a WebSocket connection from the list on the left (it will have the status "101 Switching Protocols".
  • Click the Frames tab. Binary frames will be displayed with the length and timestamp and indicate whether they are masked. Text frames will also be displayed as payload contents.

Also this (somewhat old) blog article from 2012: Checking WebSocket traffic with Chrome Development Tools

+3
source share

All Articles