Step 5: Test the PushTopic Channel
- To load the Visualforce page in a web browser, click Preview on the Visualforce page editor:
- In the text box, enter the channel name: /topic/InvoiceStatementUpdates.
- To subscribe to the channel, click Subscribe.
-
Create or modify an invoice statement in a different browser tab. The page displays some debug
messages and event notifications. The output resembles the following:
1DEBUG: Handshake Successful: { 2 "ext":{"replay":true,"payload.format":true}, 3 "minimumVersion":"1.0", 4 "clientId":"41kdiuvgig2tfxdh9weakuiwyh", 5 "supportedConnectionTypes":["long-polling"], 6 "channel":"/meta/handshake", 7 "id":"1","version":"1.0","successful":true,"reestablish":false} 8 9DEBUG: Connection Successful : { 10 "clientId":"41kdiuvgig2tfxdh9weakuiwyh", 11 "advice":{ 12 "interval":2000,"multiple-clients":true,"reconnect":"retry", 13 "timeout":110000},"channel":"/meta/connect","id":"2", 14 "successful":true} 15 16DEBUG: Subscribe Successful /topic/InvoiceStatementUpdates: 17{"clientId":"41kdiuvgig2tfxdh9weakuiwyh","channel":"/meta/subscribe", 18 "id":"15","subscription":"/topic/InvoiceStatementUpdates","successful":true} 19 20 21{ 22 "event": { 23 "createdDate": "2017-05-16T23:05:50.173Z", 24 "replayId": 1, 25 "type": "created" 26 }, 27 "sobject": { 28 "Description__c": "New invoice.", 29 "Id": "a00D0000009YbwQIAS", 30 "Status__c": "Open", 31 "Name": "INV-0001" 32 } 33} 34_____________ 35 36{ 37 "event": { 38 "createdDate": "2017-05-16T23:06:11.529Z", 39 "replayId": 2, 40 "type": "updated" 41 }, 42 "sobject": { 43 "Description__c": "New invoice.", 44 "Id": "a00D0000009YbwQIAS", 45 "Status__c": "Negotiating", 46 "Name": "INV-0001" 47 } 48} 49_____________The debug messages contain information about the subscription status. The first event notification shows the notification data when an invoice statement is created. The second notification shows the notification data when an invoice statement is updated.
Click Unsubscribe to unsubscribe from the channel and stop receiving notifications.