Access differences between WebSocket and TCP
LongPort support WebSocket and TCP feed, the differences:
- Data of
TCPis streaming, so coding client is hard thanWebSocket. WebSocketusing URL Query to HandshakeWebSocketusing ping-pong to do Heartbeating, instead of sending heartbeat packet.WebSocketusingTLSto secure connection, butTCPdo not.
User can choice TCP or WebSocket on self demand.
Advice: Using
WebSocketfirst, it is more simple. If want more quick stock quote real-time pushing, usingTCPto access stock quote gateway.