Persist one browser user agent for Axios and WebSockets

This commit is contained in:
Brandon Li
2026-10-19 06:08:23 -05:00
parent 13e03c3d0f
commit ed56e306d1
21 changed files with 380 additions and 64 deletions
+2 -3
View File
@@ -106,14 +106,13 @@ class TopstepxFeed implements Feed {
constructor(readonly firmId: string, readonly firmName: string, token: () => string | null) {
// Like the user hub: one websocket, through the operator's proxy.
const proxiedWs = signalrWebSocket();
const configuredWs = signalrWebSocket();
this.hub = new signalR.HubConnectionBuilder()
.withUrl(MARKET_HUB, {
skipNegotiation: true,
transport: signalR.HttpTransportType.WebSockets,
accessTokenFactory: () => token() ?? '',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...(proxiedWs ? { WebSocket: proxiedWs as any } : {}),
...{ WebSocket: configuredWs },
})
.withAutomaticReconnect()
.configureLogging(signalR.LogLevel.Warning)