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