[GH-ISSUE #4886] [Feature]: server speed display #3417

Closed
opened 2026-10-31 20:32:17 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @bl00dychains on GitHub (Jun 4, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4886

add the ability to view the consumed speed in the inbounds section

Originally created by @bl00dychains on GitHub (Jun 4, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4886 add the ability to view the consumed speed in the inbounds section
Author
Owner

@github-actions[bot] commented on GitHub (Jun 4, 2026):

Thanks for the request! Here's what the codebase currently does and what would be needed to add per-inbound speed.

What already exists

XrayTrafficJob (web/job/xray_traffic_job.go) runs every 5 seconds. Each cycle it calls Xray's gRPC QueryStats API, computes per-inbound byte deltas (bytes transferred since the last poll), and broadcasts them to the frontend via WebSocket as a traffic message with this shape:

{
  "traffics": [
    { "tag": "inbound-tag", "up": 12345, "down": 67890, "isInbound": true },
    ...
  ],
  "clientTraffics": [...],
  "onlineClients": [...],
  ...
}

So the raw per-inbound throughput data is already flowing to the frontend every 5 s. The Inbound.Up / Inbound.Down fields in the database are cumulative totals (not speed); the speed signal lives exclusively in the WebSocket delta stream.

The main-page "overall speed" widget reads system-wide NIC throughput from gopsutil (Status.NetIO.Up/Down in web/service/server.go) — that's a different data source and sums all interfaces, not per-inbound.

What is missing for this feature

The frontend inbounds list does not yet consume the per-inbound traffics deltas to display a live speed column. Implementing it would require:

  1. Frontend (frontend/): In the WebSocket traffic handler, map each traffics[i].tag to the corresponding inbound row and compute bytes / 5s → display as "↑ X KB/s ↓ Y KB/s" (the 5-second polling interval is fixed server-side).
  2. No backend changes are required — the data is already there.

If you'd like to implement this yourself, the relevant files are:

  • web/job/xray_traffic_job.go — where the WebSocket broadcast is assembled
  • web/websocket/hub.go / notifier.go — MessageTypeTraffic constant and BroadcastTraffic
  • frontend/ — React inbounds list component that renders the inbound rows
<!-- gh-comment-id:4617942881 --> @github-actions[bot] commented on GitHub (Jun 4, 2026): Thanks for the request\! Here's what the codebase currently does and what would be needed to add per-inbound speed. **What already exists** `XrayTrafficJob` (`web/job/xray_traffic_job.go`) runs every **5 seconds**. Each cycle it calls Xray's gRPC `QueryStats` API, computes per-inbound byte **deltas** (bytes transferred since the last poll), and broadcasts them to the frontend via WebSocket as a `traffic` message with this shape: ```json { "traffics": [ { "tag": "inbound-tag", "up": 12345, "down": 67890, "isInbound": true }, ... ], "clientTraffics": [...], "onlineClients": [...], ... } ``` So the raw per-inbound throughput data **is already flowing to the frontend** every 5 s. The `Inbound.Up` / `Inbound.Down` fields in the database are cumulative totals (not speed); the speed signal lives exclusively in the WebSocket delta stream. The main-page "overall speed" widget reads system-wide NIC throughput from `gopsutil` (`Status.NetIO.Up/Down` in `web/service/server.go`) — that's a different data source and sums all interfaces, not per-inbound. **What is missing for this feature** The frontend inbounds list does not yet consume the per-inbound `traffics` deltas to display a live speed column. Implementing it would require: 1. **Frontend** (`frontend/`): In the WebSocket `traffic` handler, map each `traffics[i].tag` to the corresponding inbound row and compute `bytes / 5s` → display as "↑ X KB/s ↓ Y KB/s" (the 5-second polling interval is fixed server-side). 2. **No backend changes are required** — the data is already there. If you'd like to implement this yourself, the relevant files are: - `web/job/xray_traffic_job.go` — where the WebSocket broadcast is assembled - `web/websocket/hub.go` / `notifier.go` — `MessageTypeTraffic` constant and `BroadcastTraffic` - `frontend/` — React inbounds list component that renders the inbound rows
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3417
No description provided.