Current Status
Scrapingbypass API does not currently support bypassing Cloudflare protections for WebSocket (WS/WSS) connections.
Technical Context
WebSocket handshakes differ significantly from standard HTTP requests. To successfully pass a Cloudflare-protected WebSocket upgrade, the following must be synchronized:
- Upgrade Headers: Validating the
Connection: UpgradeandUpgrade: websocketheaders. - Cookie Persistence: The
cf_clearancecookie used for the handshake must be valid and bound to the specific TLS/JA3 fingerprint of the connecting client. - Persistent Handshaking: Cloudflare often challenges the initial HTTP GET request before allowing the protocol switch.
Roadmap & Alternatives
While direct WebSocket support is not available in the current version of the Scrapingbypass API, we recommend the following for data collection:
- Poll REST APIs: Most sites using WebSockets also expose internal REST endpoints for data updates. Check the Network tab for XHR/Fetch requests that can be handled via Scrapingbypass API V2.
- Headless Integration: For real-time requirements, ensure your local headless environment matches the TLS fingerprinting used during the initial bypass phase.
Important Notice
We are actively evaluating WebSocket support for future releases. For high-frequency data requirements, please utilize the Scrapingbypass API V2 with session persistence to maintain low-latency HTTP connections.