Skip to main content

WebSocket Connection Support for Agents

Configure and verify Secure WebSocket (port 443) agent connectivity in NetBeez NextGen alongside TCP/TLS socket fallback.

Written by Panickos Neophytou

NetBeez Agents can connect to the NetBeez server's communication service (nb-commsrv) using either a standard TCP/TLS socket (port 20018) or a Secure WebSocket connection over HTTPS (port 443 at wss://<your-netbeez-hostname>/agent/ws). WebSocket transport is helpful in restrictive firewall or proxy environments that block outbound traffic on non-standard TCP ports.

In this article:

How Agent WebSocket Connectivity Works

  • Port 443 Reverse Proxy: When WebSockets are enabled on the server, nb-nginx terminates TLS on TCP port 443 at /agent/ws and upgrades the connection to nb-commsrv (internal port 4443). See Network Firewall Settings for complete port requirements.

  • Full TCP/TLS Compatibility & Automatic Fallback: Standard TCP/TLS socket connections (port 20018) remain enabled and supported alongside WebSockets—no immediate change is required on existing agents. If an agent cannot establish a WebSocket connection, it automatically falls back to a TCP/TLS socket connection (see Agent Doesn't Connect to the Dashboard).

Offline Test Result Caching Limitation

WebSocket connections use a stateless JSON framing protocol that does not cache continuous test results locally on the agent if the agent loses connectivity to the NetBeez server. If your deployment requires agents to buffer test metrics locally while unreachable and flush them upon reconnection, keep agents on the default TCP/TLS socket connection (port 20018).

Enabling WebSockets on Self-Hosted NextGen Servers

By default, NetBeez NextGen ships with agent WebSockets disabled (WEBSOCKET_DISABLED=true in app_data/env_files/nb-commsrv.env). On a self-hosted server where you have root SSH access, enable WebSockets in the persistent user_data override directory so your setting survives NetBeez Software Updates:

  1. SSH into your NetBeez server and edit (or create) /opt/netbeez/user_data/env_files/nb-commsrv.env as root, setting:

    WEBSOCKET_DISABLED=false

    Note: Do not edit /opt/netbeez/app_data/env_files/nb-commsrv.env directly, as app_data is replaced during server upgrades.

  2. Recreate the commsrv service container (nb-commsrv) so the override takes effect:

    /opt/netbeez/app_data/bin/nb-docker-compose up -d --force-recreate --no-deps commsrv
  3. Verify that each nb-commsrv worker process initialized its WebSocket listener by checking the container logs:

    docker logs nb-commsrv

    Confirm that the worker startup output logs New Websocket server: true (rather than Websocket server: DISABLED).

NetBeez Cloud-Hosted Servers

If your NetBeez NextGen server is cloud-hosted by NetBeez and you do not have root OS access, open Help & Support in the primary navigation or email support@netbeez.net to request enabling agent WebSockets on your instance.

Did this answer your question?