Setup

A GraphQL subscription is a feature that allows clients to receive real-time updates from the server over a persistent connection, typically using WebSockets. Subscriptions are useful for scenarios where the client needs to be notified about data changes. When a specified event occurs on the server, the subscription triggers, sending the updated data to the subscribed clients.

You subscriptions are on a different endpoint to the main GraphQL Scheme, you can navigate the schema in an IDE/Playground at https://hub.production.racing.tote.co.uk/partner/connections/graphql/ with the websocket endpoint to accept requests located at wss://hub.production.racing.tote.co.uk/partner/connections/graphql/

Example use cases for this:

  • Place bets then listen for a response via web socket if it was accepted or rejected
  • Listen for pool total changes, instead of polling the API

For the following subscriptions - you are required to be authorized so you receive only the bets that are relevant to your account. In order to achieve this pass in the Authorization header as you would for other requests.

  • onBetAccepted
  • onBetCancelled
  • onBetFailed
  • onBetRejected
  • onBetResulted
  • onBetSettled
  • onCompetitorStatusChanged
  • onEventResultChanged
  • onEventStatusChanged
  • onEventUpdated
  • onLinesChanged
  • onPoolDividendChanged
  • onPoolTotalChanged
  • onProductStatusChanged
  • onSelectionStatusChanged

There is a working code example here