---
schema_version: "1"
id: b572ac64218350882d410a5a6bbdb762955e7c2c47c1917b43ea807bef1754d5
title: Unsubscribing from a Streaming API Event
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/canvas-framework/guides/platform-connect/using/streaming-api/canvas-app-streaming-unsubscribe-code-example.md
canonical_url: https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-streaming-unsubscribe-code-example.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7feb3d02664d6b9a1441ea7435886a0a332872ca7d47f790630a5b51bcd725dd
products:
  - Canvas Developer Guide
  - Platform Developer Content
---

# Unsubscribing from a Streaming API Event

This code example shows how to call the `unsubscribe` method so that a canvas app can unsubscribe from a Streaming API event.

<!-- otherprops: set_clipboard -->
```java
//Unsubscribe from Streaming API events.
//The PushTopic to unsubscribe from must be passed in.
Sfdc.canvas(function() {
    sr = JSON.parse('<%=signedRequestJson%>');
    Sfdc.canvas.client.unsubscribe(sr.client, {name : 'sfdc.streamingapi',
        params:{topic:"/topic/InvoiceStatements"}});
});
```

**See Also**  


-   [Using the Streaming API Event](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-streaming-event-code-example.md)
-   [Subscribing to a Streaming API Event](https://developer.salesforce.com/docs/platform/canvas-framework/guide/canvas-app-streaming-subscribe-code-example.md)

