Documentation

Forget

SubscriptionNo Auth

Stop a real-time stream by its ID. Unchanged in the New API.

Quick comparison

AspectLegacy APINew APIAction
EndpointforgetforgetNone
Auth RequiredNoNoNone
Stream ID pattern^[\w-]{32,128}$^[\w-]{32,128}$None
forget response fieldOptionalOptionalNone

Request and response fields

Request

  • forget (required): the stream ID, matching ^[\w-]{32,128}$. Use the subscription.id of the stream you want to stop.
  • passthrough (optional): data returned to you in echo_req.
  • req_id (optional): an ID that maps the response to your request.

Response

  • echo_req and msg_type (forget): always returned.
  • forget (optional): 1 means the stream stopped. 0 means the stream did not exist.
  • req_id: returned when you send one.

Request structure

Legacy APIrequest example
{
  "forget": "d1ee7d0d-3ca9-fbb4-720b-5312d487185b"
}
New APIrequest example
{
  "forget": "d1ee7d0d-3ca9-fbb4-720b-5312d487185b"
}

Response structure

Legacy APIresponse example
{
  "echo_req": {
    "forget": "d1ee7d0d-3ca9-fbb4-720b-5312d487185b"
  },
  "forget": 1,
  "msg_type": "forget"
}
New APIresponse example
{
  "echo_req": {
    "forget": "d1ee7d0d-3ca9-fbb4-720b-5312d487185b"
  },
  "forget": 1,
  "msg_type": "forget"
}

Code examples

function stopStream(streamId) {
  ws.send(JSON.stringify({ forget: streamId }));
}

ws.onmessage = (event) => {
  const response = JSON.parse(event.data);
  if (response.error) {
    console.error(response.error.message);
    return;
  }
  if (response.msg_type !== 'forget') return;

  if (response.forget === 1) {
    console.log('Stream stopped');
  } else if (response.forget === 0) {
    console.log('Stream did not exist');
  } else {
    console.log('No forget result returned');
  }
};
Click to open live chat support. Get instant help from our support team.