Connection Management

PING/PONG

UPbit's OpenAPI WebSocket server supports WebSocket PING/PONG Frame in order to manage and maintain stable connections.
(Reference : https://tools.ietf.org/html/rfc6455#section-5.5.2 )

Client to Server PING

  • By default, the server will disconnect from the WebSocket connection if no data is being sent or received for 120 seconds by an Idle Timeout.
  • To prevent this, the client has to send PING messages to the server to maintain the connection. You can also check the status of the WebSocket server and WebSocket connection status by this.
  • UPbit's OpenAPI WebSocket server status is now PING Frame receiving capable. You may check the status of the server through PING request/PONG response (response frame regarding PING) through a simple implementation from the client.
  • Please refer to the client development document for the configuration. (Most libraries have a ping function)

πŸ“˜

When having difficulty to send PING Frame

Alternatively, you can maintain the connection by sending a PING message.
If the connection is successfully maintained, {"status":"UP"} response will come every 10 seconds.

$ telsocket -url wss://api.upbit.com/websocket/v1
Connected!
PING
{"status":"UP"}
{"status":"UP"}
{"status":"UP"}
...

WebSocket Compression

UPbit's OpenAPI WebSocket server provides WebSocket compression in order to send data at faster speeds.
(Reference: https://tools.ietf.org/html/rfc7692 )

  • In a WebSocket client that supports WebSocket Compression, you may communicate in a compression state if you activate the options that are designated for each client. Since raw data is provided in a decompressed state at the user code level, the user doesn't have to write any code other than the setting option activation.
  • In a WebSocket client that does not support WebSocket Compression, this function cannot be used. You will receive data in raw JSON form. Please switch to WebSocket Client in order to use this function.