实时推送

PushClient 使用 TCP+TLS、varint32 帧和 Protobuf。一个 Tiger ID 同时只能保持一个有效长连接;新连接可能踢出旧连接。

安全提示:SDK 首次连接会验证 TLS 证书。证书错误路径会提示“无验证重试”,但当前实现会在重试前重置该标志,因此不能依赖该回退建立连接;不要通过自定义 socketFactory 关闭证书验证。

import { createClientConfig, PushClient } from '@tigeropenapi/tigeropen';

const client = new PushClient(createClientConfig());
client.setCallbacks({ onError: console.error });
await client.connect();
client.subscribeQuote(['AAPL']);

Did this page help you?