szmarczak / http2-wrapper

Use HTTP/2 the same way like HTTP/1
MIT License
239 stars 18 forks source link

RangeError: Invalid WebSocket frame: RSV2 and RSV3 must be clear #59

Closed yovanoc closed 3 years ago

yovanoc commented 3 years ago

Follow up #46

CONNECTED!
RangeError: Invalid WebSocket frame: RSV2 and RSV3 must be clear
    at Receiver.getInfo (/Users/devchris/Library/Mobile Documents/com~apple~CloudDocs/Documents/code/nodejs/http2-wrapper/node_modules/ws/lib/receiver.js:171:14)
    at Receiver.startLoop (/Users/devchris/Library/Mobile Documents/com~apple~CloudDocs/Documents/code/nodejs/http2-wrapper/node_modules/ws/lib/receiver.js:131:22)
    at Receiver._write (/Users/devchris/Library/Mobile Documents/com~apple~CloudDocs/Documents/code/nodejs/http2-wrapper/node_modules/ws/lib/receiver.js:78:10)
    at writeOrBuffer (node:internal/streams/writable:395:12)
    at Receiver.Writable.write (node:internal/streams/writable:340:10)
    at ClientHttp2Stream.socketOnData (/Users/devchris/Library/Mobile Documents/com~apple~CloudDocs/Documents/code/nodejs/http2-wrapper/node_modules/ws/lib/websocket.js:900:35)
    at ClientHttp2Stream.emit (node:events:376:20)
    at addChunk (node:internal/streams/readable:311:12)
    at readableAddChunk (node:internal/streams/readable:286:9)
    at ClientHttp2Stream.Readable.push (node:internal/streams/readable:225:10) {
  [Symbol(status-code)]: 1002
}
DISCONNECTED!
szmarczak commented 3 years ago

If you have an access to the source code of the WebSocket server, can you share some minimal example? If not, can you share the URL you're trying to connect to?

yovanoc commented 3 years ago

https://proxyconnection.touch.dofus.com?STICKER=6hia7dpWJgeSF4zn

Its a Primus server with Engine.io as a transport

Thanks

szmarczak commented 3 years ago

I've sketched a raw WebSocket example here:

https://gist.github.com/szmarczak/01e489f8115222c72db1e55e49e82f5c

I will try to do this using http2.

szmarczak commented 3 years ago

Its a Primus server with Engine.io as a transport

Engine.io uses HTTP/1.1, so you have to use HTTP/1.1 here. I highly doubt CloudFlare proxies HTTP/2 WebSockets to HTTP/1.1.