Persist one browser user agent for Axios and WebSockets
This commit is contained in:
@@ -184,7 +184,24 @@ It is read-only unless `DX_CONFIRM=yes DX_ACCOUNT=<code>` are set too, which
|
||||
adds one minimum-size live round trip.
|
||||
|
||||
`npm run check` runs the pure-logic checks (fees, stops, sizing, trading
|
||||
hours, the DXtrade selector, the futures draw and instrument lists).
|
||||
hours, the DXtrade selector, the futures draw and instrument lists), plus local
|
||||
HTTP/WebSocket checks against a temporary database.
|
||||
|
||||
### Outbound user agent
|
||||
|
||||
On first server load, each instance randomly selects a desktop Chrome,
|
||||
Firefox, or Edge user agent and saves it as `user_agent` in its settings.
|
||||
Settings → Network shows the selected value. It stays the same across requests,
|
||||
WebSocket reconnects, page reloads, and server restarts, and travels with backups.
|
||||
An existing saved value is reused; an absent or blank value is generated automatically.
|
||||
|
||||
All server Axios calls use `lib/http-client.ts`; import Axios from
|
||||
`@/lib/http-client` when adding requests. Its defaults and interceptor also apply
|
||||
to `axios.create()` clients, so per-request headers cannot accidentally replace
|
||||
the saved user agent. ESLint rejects direct application imports of the Axios package.
|
||||
Use `brokerWebSocket` or `signalrWebSocket` from `lib/outbound-proxy.ts` for broker
|
||||
sockets, and `directWebSocket` for control sockets. All share the same user agent;
|
||||
the broker proxy still applies only to broker traffic.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user