How to debug 'Invalid frame header' Websocket issues with Rails/websocket-rails (standalone) How to debug 'Invalid frame header' Websocket issues with Rails/websocket-rails (standalone) ruby ruby

How to debug 'Invalid frame header' Websocket issues with Rails/websocket-rails (standalone)


I think you are looking for the following resources:

From the question thread: debugging websocket in google chrome

Chrome developer tools now have the ability to list WebSocket frames and also inspect the data if the frames are not binary.

Process:

  1. Launch Chrome Developer tools
  2. Load your page and initiate the WebSocket connections
  3. Click the Network Tab.
  4. Select the WebSocket connection from the list on the left (it will have status of "101 Switching Protocols".
  5. Click the Frames sub-tab. Binary frames will show up with a length and time-stamp and indicate whether they are masked. Text frames will show also include the payload content.

Theres also this (somewhat old) blog article from 2012: Inspecting WebSocket Traffic with Chrome Developer Tools


I think that there's something wrong with the format of the data being sent over the wire.

Carefully look at the format of the message. Has it been properly stringified? Do your brackets and parens, {}, [], and () all match? Did your IDE insert an extra somewhere? Try validating a message with a linter or an online validator.

Inspect the message on both the sender and receiver sides. Make sure that everything is correct.


This may not be the answer to the author's original question but I want to add a possible solution to this Invalid Frame Header error.From my small research, Invalid Frame Header can be generated on Websocket protocol when the server sends an empty response (message with 0 length). 0 length in TCP signals that connection has been closed and therefore any data transmission after the empty message fails.This is the link that helped me to find this solution. I hope someone in the future will find this useful and save some time.