AptosAptos Network's breakthrough technology and seamless user experience are now available on QuickNode.

Start building today!     

Contents

slotUnsubscribe RPC Method

The API credit value for this method is 1 . To learn more about API credits and each method's value, visit the API Credits page.

Parameters:

  1. number - id of account Subscription to cancel

Returns:

  1. Result - The result will be an RpcResponse JSON object with:

    boolean - unsubscribed success message

Code Examples:

import solana
import asyncio
from asyncstdlib import enumerate
from solana.rpc.websocket_api import connect

async def main():
    async with connect("wss://sample-endpoint-name.network.quiknode.pro/token-goes-here/") as websocket:
        await websocket.slot_subscribe()
        first_resp = await websocket.recv()
        subscription_id = first_resp.result
        async for idx, msg in enumerate(websocket):
            if idx == 3:
                break
            print(msg)
        await websocket.slot_unsubscribe(subscription_id)

asyncio.run(main())
Ready to get started? Create a free account