Pacifica
  • Getting Started
    • Closed Alpha Guide
      • Link To Guide PDF
    • Closed Alpha Trading Competition
  • Trading on Pacifica
    • Overview
    • Contract Specifications
      • Oracle Price & Mark Price
      • Settlement Mechanism
    • Order Types
      • Market Order
      • Limit Order
      • Order Rules & Constraints
    • Margin & Leverage
    • Funding Rates
    • Liquidations
  • API Documentation
    • API
      • REST
        • Account
        • Agent
        • Funding
        • Info
        • Kline
        • Orders
        • Portfolio
        • Positions
        • Models
      • Websocket
        • Orderbook
        • Trades
        • Orders
        • Positions
        • User Order History
        • User Trade History
        • Candle
        • Account Data
    • Specification
  • Other
    • Brand Assets
    • Contact Us
    • Glossary of Terms
Powered by GitBook
On this page
  • Subscription Message
  • Unsubscription Message
  • Heartbeat and Timeout
  1. API Documentation
  2. API

Websocket

wss://test-ws.pacifica.fi/ws

The API service provides a universal endpoint for websocket streams. The subscribed data will be streamed in the corresponding channel after the connection is established.

Subscription Message

{
    "method": "subscribe",
    "params": { ... }
}

Unsubscription Message

{
    "method": "unsubscribe",
    "params": { ... }
}

Heartbeat and Timeout

A webscoket connection will be closed if no message is sent for the past 60 seconds, or the connection has been alive for 24 hours.

To keep the connection alive without messages in 60 seconds, we can send a heartbeat message

{
    "method": "ping"
}

and alive connection will respond with

{
    "channel": "pong"
}
PreviousModelsNextOrderbook

Last updated 1 month ago