You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/core-backend/CHANGELOG.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
### Changed
11
+
12
+
- Improve WebSocket connection lifecycle tracing in `BackendWebSocketService` ([#7101](https://github.com/MetaMask/core/pull/7101))
13
+
- WebSocket connection duration is now properly reflected in trace span duration instead of only in custom data
14
+
- Trace all disconnections (both manual and unexpected) to provide complete connection lifecycle visibility in traces
15
+
- Omit `connectionDuration_ms` from disconnection traces when connection never established (onClose without onOpen)
16
+
- Update `BackendWebSocketService` default exponential backoff options for reconnection
17
+
- Increase default `reconnectDelay` from 500 milliseconds to 10 seconds
18
+
- Increase default `maxReconnectDelay` from 30 seconds to 60 seconds
19
+
- Simplify WebSocket disconnection code in `BackendWebSocketService`
20
+
- Centralize all disconnection logic in `ws.onclose` handler for single source of truth
21
+
- Centralize all state changes within `#establishConnection` method - state transitions only occur in `onopen` (CONNECTING → CONNECTED) and `onclose` (any state → DISCONNECTED)
22
+
- Add `MANUAL_DISCONNECT_CODE` (4999) and `MANUAL_DISCONNECT_REASON` constants to distinguish manual from unexpected disconnects
23
+
24
+
### Removed
25
+
26
+
- Remove `BackendWebSocketService Channel Message` trace as it provided no useful performance insights
Copy file name to clipboardExpand all lines: packages/core-backend/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -311,7 +311,7 @@ sequenceDiagram
311
311
#### Key Flow Characteristics
312
312
313
313
1.**Initial Setup**: BackendWebSocketService establishes connection, then AccountActivityService subscribes to selected account. Backend automatically sends a system notification with all chains that are currently up. AccountActivityService tracks these chains internally and notifies TokenBalancesController, which increases polling interval to 5 min
314
-
2.**Chain Status Tracking**: AccountActivityService maintains an internal set of chains that are 'up' based on system notifications. On disconnect/error, it marks all tracked chains as 'down' before clearing the set
314
+
2.**Chain Status Tracking**: AccountActivityService maintains an internal set of chains that are 'up' based on system notifications. On disconnect, it marks all tracked chains as 'down' before clearing the set
315
315
3.**System Notifications**: Backend automatically sends chain status updates (up/down) upon subscription and when status changes. AccountActivityService forwards these to TokenBalancesController, which adjusts polling intervals (up: 5min, down: 30s + immediate fetch)
316
316
4.**User Account Changes**: When users switch accounts, AccountActivityService unsubscribes from old account and subscribes to new account. Backend sends fresh system notification with current chain status for the new account
317
317
5.**Connection Resilience**: On reconnection, AccountActivityService resubscribes to selected account and receives fresh chain status via system notification. Automatic reconnection with exponential backoff
0 commit comments