Documentation

Forget all

SubscriptionNo Auth

Unsubscribe from all streams of a given type. Seven stream types are no longer accepted; the response is unchanged.

Quick comparison

AspectLegacy APINew APIAction
Endpointforget_allforget_allNone
Auth RequiredNoNoNone
Stream types14 types7 typesStop sending removed types

Breaking changes

1. Fewer stream types accepted

forget_all takes a stream type or an array of stream types. The New API accepts fewer types, and rejects a request that includes any other.

  • No longer accepted: p2p_advert, p2p_advertiser, p2p_order, p2p_settings, trading_platform_asset_listing, website_status and crypto_estimations.
  • Still accepted: balance, candles, cashier_payments, proposal, proposal_open_contract, ticks and transaction.

Required change: Remove the stream types the New API no longer accepts from your forget_all requests.

Request structure

Legacy APIrequest example
{
  "forget_all": [
    "ticks",
    "proposal"
  ],
  "req_id": 1
}
New APIrequest example
{
  "forget_all": [
    "ticks",
    "proposal"
  ],
  "req_id": 1
}

Response structure

Legacy APIresponse example
{
  "echo_req": {
    "forget_all": [
      "ticks",
      "proposal"
    ],
    "req_id": 1
  },
  "forget_all": [
    "c84a793b-8a87-7999-ce10-9b22f7ceead3",
    "d1f2e3a4-5b6c-7d8e-9f01-23456789abcd"
  ],
  "msg_type": "forget_all",
  "req_id": 1
}
New APIresponse example
{
  "echo_req": {
    "forget_all": [
      "ticks",
      "proposal"
    ],
    "req_id": 1
  },
  "forget_all": [
    "c84a793b-8a87-7999-ce10-9b22f7ceead3",
    "d1f2e3a4-5b6c-7d8e-9f01-23456789abcd"
  ],
  "msg_type": "forget_all",
  "req_id": 1
}

Code examples

function stopStreams(types) {
  ws.send(JSON.stringify({ forget_all: types, req_id: 1 }));
}

stopStreams(["ticks", "p2p_order"]);

ws.onmessage = (event) => {
  const response = JSON.parse(event.data);
  if (response.msg_type !== "forget_all") return;
  if (response.error) {
    console.error(response.error.message);
    return;
  }
  if (response.forget_all) {
    console.log("Stopped " + response.forget_all.length + " streams");
  }
};

Any other questions? Get in touch

Click to open live chat support. Get instant help from our support team.