Skip to content

WebSocket disconnects from zmeventserver after app is backgrounded and resumed #274

Description

@kunickig

zmNinjaNg version and build number

2.0.0

Platform

Android

OS / browser version

Android 16

Device

No response

ZoneMinder version

1.39.17

Event Server (ES) version

nevest

zm_detect version

nevest

Describe the bug

Every time I background the app for a while and then reopen it, the connection to zmeventserver shows as disconnected, with "Failed to connect to notification server" and "WebSocket error" in the logs (isTrusted: true, no further detail). Tapping "Connect" manually reconnects instantly — it's not a real connectivity issue, the app just doesn't automatically re-establish the WebSocket after coming back from background.
Interestingly, push notifications still arrive normally even while the app shows this WebSocket as disconnected — so the disconnect seems limited to the in-app WebSocket state and doesn't affect the actual push notification delivery. This suggests the WebSocket reconnect logic on resume is broken/not triggered, separate from whatever channel delivers the push notifications.

Steps to reproduce

Open the app, confirm notification server is connected.
Background the app (or lock the phone) for a few minutes.
Reopen the app.
Notification server shows disconnected with the errors above.
Tap "Connect" — reconnects immediately.

Expected behavior

App should automatically reconnect the WebSocket when resumed from background, or at least retry silently instead of requiring a manual tap. The UI state should also more accurately reflect what's actually working, since push notifications keep working despite the "disconnected" status.

Screenshots / logs

Image

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions