Feature SDKs (Enterprise)
app_debugger_websocket Enterprise
- Tier
- Enterpriseversion 1.2.4
- Command
archipelago generate app_debugger_websocket- Generates
features/app_debugger_websocket/app_debugger_websocketfeatures/app_debugger_websocket/app_debugger_websocket_apifeatures/app_debugger_websocket/app_debugger_websocket_noop
- Generates first
- app_debuggerwhen needed and missing, so there is nothing to install first
- Depends on
- shared_identifiers, websocket_sdkgenerate these first
WebSocket traffic inspector sub-brick for
app_debugger. Adds a WebSocket tool to the debugger showing a live tree of sent/received frames grouped by endpoint > topic > event. Automatically swapped to a no-op stub in production-flavor builds.
Variables
This brick has no generation-time variables. The inspector works with any WebSocket SDK implementation at runtime.
Prerequisites
app_debuggeris generated first when the project lacks it. It provides thearchipelago:debug_panel_pagessentinel insideapp_debugger's ownAppDebuggerSDKImpl— the post_gen hook patches it to eagerly resolveWebSocketInspectorSDK). The marker moved betweenapp_debuggerversions, so the hook uses the first file that has it:app_debugger'slib/src/di/debug_tools.dart(2.0.0 and later), itslib/src/app_debugger_sdk_impl.dart(1.3.0 to 1.15.x), then the app'slib/bootstrap.dart(older), and adds the imports and path dependencies to that package. A file that already resolves the SDK is left as it is. If no file has the marker,pre_genprints the lines to add and stops before it writes any file.- A WebSocket SDK must be configured (e.g.
websocket_sdk_dartorwebsocket_sdk_phoenix).
Usage
Interactive
archipelago generate app_debugger_websocketNon-interactive (CI)
archipelago generate app_debugger_websocket --config my_config.jsonGenerated Structure
features/
└── app_debugger_websocket/
├── app_debugger_websocket_api/
│ └── lib/src/
│ ├── models/
│ │ ├── websocket_inspector_config.dart
│ │ ├── websocket_traffic_direction.dart
│ │ └── websocket_traffic_entry.dart
│ └── websocket_inspector_sdk.dart # WebSocketInspectorSDK contract
├── app_debugger_websocket/
│ └── lib/src/
│ ├── di/
│ ├── websocket_debugger_interceptor.dart
│ ├── websocket_inspector_page.dart
│ └── websocket_inspector_sdk_impl.dart
└── app_debugger_websocket_noop/
└── lib/src/
└── di/Required Setup
Register the interceptor with your WebSocket client after initializeInjector():
import 'package:app_debugger_websocket_api/app_debugger_websocket_api.dart';
final wsInspector = getIt<WebSocketInspectorSDK>();
if (wsInspector.interceptor != null) {
getIt<WebSocketClient>().addInterceptor(wsInspector.interceptor!);
}The null guard makes this safe in production-flavor builds where the noop stub returns null for interceptor.
Ring Buffer Configuration
Override WebSocketInspectorConfig in a custom @module class:
| Field | Default | Description |
|---|---|---|
maxEntries | 500 | Maximum entries kept in the ring buffer |
capturePayloads | true | Whether to capture message payloads |
payloadTruncateLength | 2048 | Truncate payloads longer than this length |
How It Works
WebSocketInspectorSDKImplconstructs aWebSocketDebuggerInterceptorand registers aWebSocketInspectorPagewithDebuggerPanelPageRegistry.- The debugger home reads
DebuggerPanelPageRegistry.instance.pagesand lists each page as a tool on its own route — no import ofapp_debugger_websocketrequired. - The interceptor captures every
onSend,onReceive,onError, andonStateChangecall into a ring buffer. - The panel UI groups entries by endpoint > topic > event using
ExpansionTilewidgets and refreshes reactively viatrafficStream. build_prepare.yamlswapsapp_debugger_websocket→app_debugger_websocket_noopfor production-flavor builds.
Changelog
Run archipelago brick info app_debugger_websocket to see the latest published version. Enterprise customers can read the full CHANGELOG.md in the brick source repository.