unsubscribe
The unsubscribe
command tells the server to stop sending messages for a particular subscription or set of subscriptions.
Request Format
An example of the request format:
{
"id": "Unsubscribe a lot of stuff",
"command": "unsubscribe",
"streams": ["ledger","server","transactions","transactions_proposed"],
"accounts": ["rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1"],
"accounts_proposed": ["rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1"],
"books": [
{
"taker_pays": {
"currency": "XAG "
},
"taker_gets": {
"currency": "USD",
"issuer": "rUQTpMqAF5jhykj4FExVeXakrZpiKF6cQV"
},
"both": true
}
]
}
The parameters in the request are specified almost exactly like the parameters to the subscribe method, except that they are used to define which subscriptions to end instead. The parameters are:
Field |
Type | Description |
---|---|---|
streams |
Array | (Optional) Array of string names of generic streams to unsubscribe from, including ledger , server , transactions , and transactions_proposed . |
accounts |
Array | (Optional) Array of unique account addresses to stop receiving updates for, in the XAG Ledger's base58 format. (This only stops those messages if you previously subscribed to those accounts specifically. You cannot use this to filter accounts out of the general transactions stream.) |
accounts_proposed |
Array | (Optional) Like accounts , but for accounts_proposed subscriptions that included not-yet-validated transactions. |
books |
Array | (Optional) Array of objects defining order books to unsubscribe from, as explained below. |
The rt_accounts
and url
parameters, and the rt_transactions
stream name, are deprecated and may be removed without further notice.
The objects in the books
array are defined almost like the ones from subscribe, except that they don't have all the fields. The fields they have are as follows:
Field |
Type | Description |
---|---|---|
taker_gets |
Object | Specification of which currency the account taking the offer would receive, as an object with currency and issuer fields (omit issuer for XAG ), like currency amounts. |
taker_pays |
Object | Specification of which currency the account taking the offer would pay, as an object with currency and issuer fields (omit issuer for XAG ), like currency amounts. |
both |
Boolean | (Optional, defaults to false) If true, remove a subscription for both sides of the order book. |
Response Format
An example of a successful response:
{
"id": "Unsubscribe a lot of stuff",
"result": {},
"status": "success",
"type": "response"
}
The response follows the standard format, with a successful result containing no fields.
Possible Errors
- Any of the universal error types.
invalidParams
- One or more fields are specified incorrectly, or one or more required fields are missing.noPermission
- The request included theurl
field, but you are not connected as an admin.malformedStream
- Thestreams
field of the request is not formatted properly.malformedAccount
- One of the addresses in theaccounts
oraccounts_proposed
fields of the request is not a properly-formatted XAG Ledger address.- Note: You can subscribe to the stream of an address that does not yet have an entry in the global ledger to get a message when that address becomes funded.
srcCurMalformed
- One or moretaker_pays
sub-fields of thebooks
field in the request is not formatted properly.dstAmtMalformed
- One or moretaker_gets
sub-fields of thebooks
field in the request is not formatted properly.srcIsrMalformed
- Theissuer
field of one or moretaker_pays
sub-fields of thebooks
field in the request is not valid.dstIsrMalformed
- Theissuer
field of one or moretaker_gets
sub-fields of thebooks
field in the request is not valid.badMarket
- One or more desired order books in thebooks
field does not exist; for example, offers to exchange a currency for itself.