Overview
General Description
- WebSockets can be read by any standard websocket library. Data is organized into Public and Private Channels to which an API client may subscribe.
- All messages sent and received via WebSockets are encoded in JSON format.
- Only supported json tags will be processed, everything else will be ignored with basic error response.
- The WebSockets server expects a message or a
ping
every 30 seconds or it will end the client’s session without warning. - Private API:
wss://ws.poloniex.com/ws/private
- Public API:
wss://ws.poloniex.com/ws/public
Restrictions
- Websockets access is divided into 2 endpoints, the private endpoint only allows access to private channels, not to public channels. The public endpoint only allows access to the public channel, not the private channel. Endpoint restrictions are only valid for 'subscribe' events; other events such as 'ping, unsubscribe' are not specially restricted.
- A single IP is limited to 2000 simultaneous connections on each of the public and private channels.
- Once a connection has been established, each connection is limited to 500 requests per second.
Messages
Message | Description |
---|---|
ping (request) | Client can ping the server to keep the connection alive |
pong (response) | Server response to a ping message |
subscribe (request) | Subscribe to a channel or set of channels for single or many instruments |
unsubscribe (request) | Unsubscribe from a channel for all or specified instruments |
unsubscribe_all (request) | Removes all user’s current subscriptions |
list_subscriptions (request) | List current subscriptions |
Heartbeats
Note, ping request are issued by clients only. The server will not send ping requests.
Command | |
---|---|
{"event": "ping"} | |
{"event": "pong"} |
In order to be compatible with some traditional trading programs, we also support plain text ping
messages sent by the client, which are case-insensitive.