Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

unsubscribe

Drop a subscription locally and tell the server to stop streaming.

Signature

def unsubscribe(self, subscription_id: int) -> bool

Example

from dango.info import Info
from dango.utils.constants import MAINNET_API_URL
from dango.utils.types import PairId
 
info = Info(MAINNET_API_URL)
sid = info.subscribe_perps_trades(PairId("perp/ethusd"), print)
 
# ... later ...
ok = info.unsubscribe(sid)
print("dropped:", ok)

Parameters

subscription_idint. The id returned by a previous subscribe_* call.

Returns

boolTrue if the subscription was registered and a complete frame was sent. False if the id was unknown (or no WebSocket connection was ever opened).

Notes

  • Calling unsubscribe after disconnect_websocket returns False.
  • Safe to call on shutdown even if you never opened a subscription.

See also