Predict API (Beta)
  1. WebSocket
Predict API (Beta)
  • FAQs
  • Deployed Contracts
  • Guides
    • Understanding the Orderbook
    • [TS] How to authenticate your API requests
    • [PY] How to authenticate your API requests
    • How to create or cancel orders
  • Authorization
    • Get auth message
      GET
    • Get JWT with valid signature
      POST
  • Accounts
    • Get connected account
      GET
    • Get account activity
      GET
    • Set a referral
      POST
  • Orders
    • Get order by hash
      GET
    • Get orders
      GET
    • Get order match events
      GET
    • Create an order
      POST
    • Remove orders from the orderbook
      POST
  • Categories
    • Get categories
      GET
    • Get category by slug
      GET
  • Markets
    • Get markets
    • Get market by ID
    • Get market statistics
    • Get market last sale information
    • Get the orderbook for a market
  • Positions
    • Get positions
  • OAuth
    • Finalize a OAuth connection
    • Get the orders for a OAuth connection
    • Create an order for a OAuth connection
    • Cancel the orders for a OAuth connection
    • Get the positions for a OAuth connection
  • WebSocket
    • General Information
    • Request Format
    • Response Format
    • Subscription Topics
    • Heartbeats
    • Client Example
  1. WebSocket

Client Example

Realtime Client Example#

An example implementation of consuming our websocket api with graceful handling of heartbeats, subscribem, and message parsing.
Modified at 2026-01-12 16:02:00
Previous
Heartbeats
Built with