Use when seeing WebSocket errors like "Invalid frame header", "RSV1 must be clear", or "WS_ERR_UNEXPECTED_RSV_1" - covers multiple WebSocketServer conflicts, compression issues, and raw frame debugging techniques
SkillScore87Maintained
Automatic
◆Coding pack
Last verified 8/14/2026
What it changes
Passed 19 of 22 test cases with the skill, and 14 of 22 without it.
Without skill65%
With skill87%
Checks it passed that the model alone missed
Recommends testing repeated interval broadcasts
Checks if the first 4 bytes converted to a string equal HTTP
Identifies abortHandshake calls on conflicting WebSocketServer instances as the cause
and 2 more in the full report
5 fixed15 passed either way3 still failing0 broke
Pass-rate lift
+22 pp
Tokens
+40%
Agent turns
0%
Response time
-29%
Model gemini-3.6-flashMeasured 8/14/2026v120 of 23 cases passed with skill · 22 comparable
Tokens, turns and time describe resource use, not a dollar price.
See it in action
One of 5 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 5
Prompt
When checking raw buffer chunks in a Node.js socket push wrapper to verify if raw HTTP text was accidentally written to the socket, what string comparison should be executed on the chunk slice?
What was checked, without and with the skill
Checked
Without skill
With skill
Checks if the first 4 bytes converted to a string equal HTTP
Missed
Passed
case-20 · gemini-3.6-flash · 8/14/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md124 linessingle file
Debugging WebSocket Issues
Overview
WebSocket "invalid frame header" errors often stem from raw HTTP being written to an upgraded socket, not actual frame corruption. The most common cause is multiple WebSocketServer instances conflicting on the same HTTP server.
When to Use
Error: Invalid WebSocket frame: RSV1 must be clear
Error: WS_ERR_UNEXPECTED_RSV_1
Error: Invalid frame header
WebSocket connects then immediately disconnects with code 1006
Server logs success but client receives garbage data
Quick Reference
Symptom
Likely Cause
Fix
RSV1 must be clear
Multiple WSS on same server OR compression mismatch
Use noServer: true mode
Hex starts with 48545450
Raw HTTP on WebSocket (0x48='H')
Check for conflicting upgrade handlers
Code 1006, no reason
Abnormal closure, often server-side abort
Check abortHandshake calls
Works isolated, fails in app
Something else writing to socket
Audit all upgrade listeners
The Multiple WebSocketServer Bug
Problem
When attaching multiple WebSocketServer instances to the same HTTP server using the server option:
// ❌ BAD - Both servers add upgrade listeners, causing conflicts
const wss1 = new WebSocketServer({ server, path: '/ws' });
const wss2 = new WebSocketServer({ server, path: '/ws/other' });
What happens:
Client connects to /ws
BOTH upgrade handlers fire (Node.js EventEmitter calls all listeners)