PerBothner / DomTerm

DOM/JavaScript-based terminal-emulator/console

Home Page:https://domterm.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WebSockets connection closed after sleep on Chrome on Mac

PerBothner opened this issue · comments

When sleeping on MacOS, using Google Chromium (Chrome or Electron or Qt) the WebSocket connection is closed with a code of 1006 (Abnormal closure).

This does not happen when using Firefox or Safari. It does not happen when using Linux or WSL with Chromium. However, it happens on Chromium-based browsers (tested on Chrome, Electron, and Qt) MacOS.

Seems like a Chromium bug. There may be a work-around, but I don't have one yet. (We do want to support lost-connection reattachment as a general feature.) Using Firefox or Safari is suggested for now. I may try using webview.

I checked in a fix/work-around for this: When the WebSocket connection is closed without user action, the JavaScript will create a new connection. Preliminary testing seems to work with both Electron and Qt.