The resolved hub URL including the tradePlatform query parameter.
Intended for tests and diagnostic tooling.
Returns the underlying HubConnection for advanced use (manual .on/.invoke
calls not covered by the typed helpers below). Throws if not started yet.
Subscribe to OnConnectionStatus callbacks. The server pushes one such
event right after the handshake completes.
May be called before or after start() — registering before start() is
strongly recommended to avoid missing the initial post-handshake push.
Subscribe to OnTick callbacks. Pair with subscribeToTicks(symbol).
May be called before or after start() — registering before is recommended
so no early server push is missed.
Open the SignalR connection. Idempotent — calling twice while already connected resolves without action.
Close the SignalR connection. Safe to call on a connection that was never started or has already been closed.
Returns an AsyncIterable<TickPayload>. When symbol is omitted, every
symbol's ticks flow through.
Optionalsymbol: stringSubscribe the connection to a per-symbol tick stream. Server will push
OnTick callbacks for every tick of that symbol until unsubscribed.
Resolve a token via this client's token provider. Intended for tests to verify that the shared provider is wired correctly.
SignalR wrapper around
/hubs/mt4/v2. Holds a singleHubConnectionand exposes typed stream helpers.Lifecycle:
new MT4V2SignalRClient(opts)— synchronous; resolves the token provider and pre-computes the hub URL but does NOT open a socket.onConnectionStatus()/onTick()— MAY be called beforestart(). Registering beforestart()is recommended so no early server push (e.g. the post-handshakeOnConnectionStatus) is missed.await client.start()— opens the connection. Auth token is fetched via the provider'sgetToken();tradePlatformis appended to the URL. All callbacks queued beforestart()are attached to theHubConnectionbefore the socket opens, guaranteeing they are in place before any server push arrives.streamTicks()/streamMarginCallUpdates()/ etc. to consume server streams. Each helper returns anAsyncIterable<T>for easyfor awaituse. Stream helpers require an open connection — call them afterstart().await client.stop()— closes the connection.