Avalanche
هل أنت مستعد لاستدعاء هذا في الإنتاج؟
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
Avalanche
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
eth_unsubscribe cancels an active WebSocket subscription on an Avalanche C-Chain node, identified by the ID that eth_subscribe returned. Once cancelled, the node stops pushing eth_subscription notifications for that stream, so it is how you tear down a newHeads, logs, or pending-transaction feed you no longer need. On the C-Chain — the EVM chain where AVAX pays for gas, secured by Snowman/Avalanche consensus — releasing idle subscriptions keeps a long-lived connection tidy. Issue the call over the same wss:// session opened against https://avalanche.therpc.io/YOUR_API_KEY (chain ID 43114, 0xa86a).
newHeads subscription when a user navigates away from a live C-Chain view, so the node stops pushing block headers your UI no longer renders.logs stream before opening a new one with updated address or topic filters, avoiding overlapping notifications.| # | الاسم | النوع | مطلوب | الوصف |
|---|---|---|---|---|
| 1 | subscriptionId | string | نعم | The hex subscription ID returned by eth_subscribe. |
| النوع | الوصف |
|---|---|
| boolean | `true` if the subscription was found and cancelled. `false` if it did not exist. |
Try it live in the Avalanche playground.
| الكود | الرسالة | السبب |
|---|---|---|
-32602 | invalid subscription id | The subscription ID is malformed or belongs to a different connection. |
-32000 | subscription not found | The subscription was already cancelled or never existed. |
eth_unsubscribe must be called on the same WebSocket connection that created the subscription. A subscription ID from one socket is unknown to another, so a cross-connection call returns "invalid subscription id".المعاملات
The hex subscription ID returned by eth_subscribe.