Step 5: Test the PushTopic Channel

  1. To load the Visualforce page in a web browser, click Preview on the Visualforce page editor:

  2. In the text box, enter the channel name: /topic/InvoiceStatementUpdates.

  3. To subscribe to the channel, click Subscribe.

  4. 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  "event": {
    22    "createdDate": "2017-05-16T23:05:50.173Z",
    23    "replayId": 1,
    24    "type": "created"
    25  },
    26  "sobject": {
    27    "Description__c": "New invoice.",
    28    "Id": "a00D0000009YbwQIAS",
    29    "Status__c": "Open",
    30    "Name": "INV-0001"
    31  }
    32}
    33_____________
    34
    35{
    36  "event": {
    37    "createdDate": "2017-05-16T23:06:11.529Z",
    38    "replayId": 2,
    39    "type": "updated"
    40  },
    41  "sobject": {
    42    "Description__c": "New invoice.",
    43    "Id": "a00D0000009YbwQIAS",
    44    "Status__c": "Negotiating",
    45    "Name": "INV-0001"
    46  }
    47}
    48_____________

    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.