Newer Version Available

This content describes an older version of this product. View Latest

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.

1swfobject.registerObject("clippy.codeblock-0", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17//Unsubscribe from Streaming API events.
18//The PushTopic to unsubscribe from must be passed in.
19Sfdc.canvas(function() {
20    sr = JSON.parse('<%=signedRequestJson%>');
21    Sfdc.canvas.client.unsubscribe(sr.client, {name : 'sfdc.streamingapi',
22        params:{topic:"/topic/InvoiceStatements"}});
23});