Skip to main content
Unsubscribe stops the subscription and cleans up resources. Use this when you no longer need to receive events from a specific event path, such as when shutting down a service, removing a feature, or cleaning up temporary subscriptions.

Usage

const subscription = await client.subscribe("order/created");

// Later, when done
await subscription.unsubscribe();

When to Use

  • Service shutdown: Clean up before stopping your application
  • Feature removal: Stop receiving events for deprecated features
  • Temporary subscriptions: End subscriptions created for one-time operations
  • Resource cleanup: Free up connections and memory

Pause vs Unsubscribe

ActionEvents QueuedReconnectUse Case
PauseYescontinue()Temporary stop, maintenance
UnsubscribeNoNew subscriptionPermanent stop, cleanup
After unsubscribing, you’ll need to create a new subscription to receive events again.