Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Missing Websocket pings from backend

Open Beginner friendly
#33,515 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@cestercian is already working on this.

Since Oct 30, 2026.

  • #33530 by @cestercian — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript

Research direction

Start with lib/extension/frontend.ts, the WebSocket server entry point named in the issue, and inspect how it creates and manages client connections. Check the server's WebSocket library for ping and pong handling, then reproduce the idle disconnect through the stated HAOS proxy setup. Done when the connection stays alive beyond the 40-second idle timeout and clients that stop responding are cleaned up.

Written by the indexing model from the issue text.

Description

problem
What happened?

Hi,

I use Zigbee2MQTT from within HAOS. HAOS runs its own proxy mechanism for its apps, like this one. And it kills an open WebSocket connection after 40s if there was no data flowing in that time. If you open Zigbee2MQTT from the sidebar and you just wait a while you usually get a message popping up in the bottom right corner telling you "Websocket reconnecting...":

Image

To comply with the RFC 6455 WebSocket specification, the server must initiate the connection heartbeat using standard PING control frames. As browsers are restricted from sending them via the standard JavaScript API, this can not be fixed in the frontend.

So I suggest to implement a proper ping mechanism like this, which ensures that strict reverse proxies like HA Ingress won't drop the connection due to their 40-second idle timeout:

// Set client to status `isAlive`
this.wss.on('connection', (ws) => {
    ws.isAlive = true;
    ws.on('pong', () => { ws.isAlive = true; });
});

// Ping every 20-30 s
const interval = setInterval(() => {
    this.wss.clients.forEach((ws) => {
        if (ws.isAlive === false) return ws.terminate();
        
        ws.isAlive = false;
        ws.ping();
    });
}, 30000);

The relevant file should be this one: https://github.com/Koenkk/zigbee2mqtt/blob/master/lib/extension/frontend.ts

What did you expect to happen?

No response

How to reproduce it (minimal and precise)
  1. Install HAOS and configure the internal SSL proxy.
  2. Install the Zigbee2MQTT app.
  3. Open Zigbee2MQTT from the sidebar.
  4. Wait.
Zigbee2MQTT version

2.14.2

Adapter firmware version

7.4.5 [GA]

Adapter

SONOFF Zigbee/Thread PoE Dongle Max (Dongle-M)

Setup

I run it as a HAOS app on a Raspberry Pi 5.

Device database.db entry

No response

Debug log

No response

Notes

No response

Dominant language
TypeScript
Stars
15.8k
Forks
2k
Avg merge
1d 9h
Merged PRs (30d)
43

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Koenkk/zigbee2mqtt

All issues in Koenkk/zigbee2mqtt

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.