Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocket error when refreshing the interface #332

Open
zhaoshanhui opened this issue Oct 30, 2024 · 0 comments
Open

WebSocket error when refreshing the interface #332

zhaoshanhui opened this issue Oct 30, 2024 · 0 comments

Comments

@zhaoshanhui
Copy link

When refreshing on the phone display interface, the following error sometimes occurs, causing the entire process to terminate and requiring an npm start to restart.

node:events:491
      throw er; // Unhandled 'error' event
      ^

RangeError: Invalid WebSocket frame: invalid status code 1006
    at Receiver.controlMessage (/home/ws-scrcpy/node_modules/ws/lib/receiver.js:624:30)
    at Receiver.getData (/home/ws-scrcpy/node_modules/ws/lib/receiver.js:477:12)
    at Receiver.startLoop (/home/ws-scrcpy/node_modules/ws/lib/receiver.js:167:16)
    at Receiver._write (/home/ws-scrcpy/node_modules/ws/lib/receiver.js:94:10)
    at writeOrBuffer (node:internal/streams/writable:391:12)
    at _write (node:internal/streams/writable:332:10)
    at Receiver.Writable.write (node:internal/streams/writable:336:10)
    at Socket.socketOnData (/home/ws-scrcpy/node_modules/ws/lib/websocket.js:1305:35)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
Emitted 'error' event on WebSocket instance at:
    at Receiver.receiverOnError (/home/ws-scrcpy/node_modules/ws/lib/websocket.js:1191:13)
    at Receiver.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'WS_ERR_INVALID_CLOSE_CODE',
  [Symbol(status-code)]: 1002
}

How can this issue be resolved? Or is there a way to restart the web socket directly without needing npm start?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant