1

I'm developing something related to the Chrome Headless pattern, and I'm using Java, so I need to connect to the Chrome browser using Websocket.

The tool I use is Java-WebSocket. When I started Chrome with the command line, and then connected to Chrome with websocket, it worked. chrome --headless --disable-gpu --remote-debugging-port=9222 ws://localhost:9222/devtools/page/4477eb1d-b1e2-4163-8250-0b3f93c0ea14
But after a full 60s, the connection is disconnected and the feedback code is 1006, which looks like the browser is actively disconnecting.

What I want to know is how to turn off this auto disconnect, or to extend the automatic shutdown time.

Thanks.

helun cao
  • 11
  • 1
  • Based on what I read 1006 means closing without a closing frame. If that was true it was not really closed by chrome. "It is designated for use in applications expecting a status code to indicate that the connection was closed abnormally" – dbalakirev Aug 21 '17 at 15:44
  • You may find this useful: https://stackoverflow.com/questions/19304157/getting-the-reason-why-websockets-closed-with-close-code-1006 – dbalakirev Aug 21 '17 at 15:47

0 Answers0