Production usage
Set timeouts and bound concurrency
Set an HTTP timeout for each operation and limit concurrent requests across workers. See Configuration for client options.
Retry reads deliberately
Retry transient read failures with a maximum attempt count or deadline, exponential backoff and jitter. Respect server retry guidance. Correct invalid parameters, permissions and signatures before retrying.
Resolve uncertain order outcomes
Binance may accept an order before a request times out. For Spot, query getOrder() with the symbol and origClientOrderId (the submitted newClientOrderId) or orderId before resubmitting. Check fills as needed. For derivatives, use the matching futures client's query methods.
Save order identifiers before submission. Track acknowledgement, acceptance and fills separately.
Recover streaming state
The client reconnects and restores subscriptions. Listen for reconnecting, reconnected and exception, and reconcile orders and balances after a connection gap.
For a local order book, follow Binance's documented snapshot and depth-update sequence rules. Reconnecting a socket alone does not rebuild an accurate book.
Track feed freshness and finish recovery before using affected data for new orders.
Logging
Record operation names, response codes, duration, retries and reconnects. Select fields using the SDK's error format; whole request and error objects can contain credentials.
Shut down cleanly
Stop new work, settle or reconcile outstanding requests, call WebsocketClient.closeAll() and clear application timers. The stream example includes shutdown handlers.
Upgrading
Review release notes and run integration checks before upgrading. Commit the lockfile to reproduce deployed versions.