I’m running a custom NinjaScript AddOn on NT8 that maintains a persistent Socket IO (WebSocket) connection to a remote signal service. The AddOn receives trade signals and submits orders via Account.CreateOrder / Account.Submit, optionally wrapping them in ATM strategies via AtmStrategy.StartAtmStrategy. It also subscribes to Account.PositionUpdate for ATM lifecycle tracking.
While the AddOn is connected to its Socket IO server, the NinjaTrader account occasionally loses its broker connection. When the AddOn is not running, the broker connection appears stable.
The two connections are entirely independent, so I don’t think Socket IO is interfering with the broker session directly. I suspect the AddOn is contributing indirectly (e.g., dispatcher thread
contention, disk I/O on the UI thread from logging, or unhandled exceptions inside PositionUpdate handlers), but I’d like to confirm before going further.
-
Are there known patterns in AddOn code that can cause NT8’s broker connection to drop (e.g., long-running work on
Dispatcher, heavy use ofDispatcherPriority.Send, exceptions thrown fromAccount.PositionUpdatehandlers)? -
Does NT8’s broker session rely on the WPF dispatcher for heartbeats or keepalives, such that UI-thread saturation could cause the broker to time out?
-
Is there a recommended way to diagnose which side (AddOn vs. broker vs. network) initiated a given disconnect? Specifically, where in the NT log should I look for the disconnect reason code?
Environment:
- NinjaTrader 8
- Connection: My Rithmic for NinjaTrader Brokerage
- AddOn uses SocketIOClient v4 and subscribes to
PositionUpdateon active accounts
Any guidance on diagnosis or things to rule out would be appreciated.