Repository navigation
Feature: TrueNAS WebSocket API for disk health and system summary - #546
Merged
Merged
Conversation
Add a WebSocket client and JSON-RPC session on Node core HTTP, behind the outbound guard. Disk Health reads TrueNAS pools over it, with REST kept for TrueNAS before 25.04. System Summary gains a TrueNAS source. Both refuse an http address and offer a self-signed certificate switch.
Open
5 tasks done
- Mark every pending JSON-RPC call and notification wait as handled, so a session that ends with promises nobody awaited does not exit the process. - End the WebSocket connection when more than 64 KiB of outbound frames queue up, so a peer that sends pings and reads no pongs cannot grow memory. - End the connection on reserved control opcodes, as RFC 6455 requires. - Store the TrueNAS CPU temperature under the key the System Summary temperature slot reads. - Reject pending waits on close in the fake session, like the real one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
api/src/websocket.js: an RFC 6455 client (masked text frames, fragments, ping/pong, close, 4 MiB message cap) and a JSON-RPC 2.0 session with calls and notification waits.jsonRpcCheckedandjsonRpcUncheckedto the outbound boundary inproxy.js. The upgrade request reuses the SSRF guard, IP pinning with SNI,resolveSkipTlsand one deadline for connect and calls.ctx.jsonRpcto widgetdata.js, checked unless the fetcher is the saved-config one, inside the widget budget.auth.login_with_api_keyandpool.queryon/api/current. Fall back to REST/api/v2.0/poolwhen the upgrade is refused (TrueNAS before 25.04). Default a bare address to https, refusehttp://before the key is sent, addtruenasSkipTls.truenassource. CPU, CPU temperature and memory from thereporting.realtimeevent, memory without the ZFS ARC. Pool usage from each pool's top dataset, an empty slot reads the first pool. Uptime fromsystem.infoonly for the uptime row, null when the key lacksREADONLY_ADMIN.Testing
All green, plus e2e. Added transport tests against a local WebSocket server, and TrueNAS tests for both widgets on a shared fake session; verified against TrueNAS 27.0.0-RC.1 with a key limited to
REPORTING_READ,POOL_READandDATASET_READ.Changelog
Added
Changed
Checklist