Persist one browser user agent for Axios and WebSockets
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
* all zeros; a blown account shows up as canTrade=false → active=false.
|
||||
*/
|
||||
|
||||
import axios from 'axios';
|
||||
import axios from './http-client';
|
||||
import * as signalR from '@microsoft/signalr';
|
||||
import { currentTradeDateCT, FUND_EVENT_MIN, fundReconcileStep, type FundSighting } from './trading-logic';
|
||||
import { getCachedContract } from './contract-resolver';
|
||||
@@ -676,14 +676,13 @@ export class TopstepXClient implements PlatformClient {
|
||||
// everything the hub does, just slower).
|
||||
// With skipNegotiation the hub is a single websocket to a broker
|
||||
// endpoint, so it follows the operator's proxy like the REST calls do.
|
||||
const proxiedWs = signalrWebSocket();
|
||||
const configuredWs = signalrWebSocket();
|
||||
const hub = new signalR.HubConnectionBuilder()
|
||||
.withUrl(USER_HUB, {
|
||||
skipNegotiation: true,
|
||||
transport: signalR.HttpTransportType.WebSockets,
|
||||
accessTokenFactory: () => this.token ?? '',
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
...(proxiedWs ? { WebSocket: proxiedWs as any } : {}),
|
||||
...{ WebSocket: configuredWs },
|
||||
})
|
||||
.withAutomaticReconnect()
|
||||
.configureLogging(signalR.LogLevel.Warning)
|
||||
|
||||
Reference in New Issue
Block a user