Newer Version Available

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

Step 4: Test the PushTopic Channel

Make sure the browser that you used in Step 3: Subscribe to the PushTopic Channel stays open and the connection doesn’t time out. You’ll view event notifications in this browser.

The final step is to test the PushTopic channel by creating a new InvoiceStatement record in Workbench and viewing the event notification.

  1. In a new browser window, open an instance of Workbench and log in using the same username by following the steps in Step 3: Subscribe to the PushTopic Channel.

    If the user that makes an update to a record and the user that’s subscribed to the channel don’t share records, then the subscribed user won’t receive the notification. For example, if the sharing model for the organization is private.

    Note

  2. Click data | Insert.
  3. For Object Type, select Invoice_Statement__c. Ensure that the Single Record field is selected, and click Next.
  4. Type in a value for the Description__c field.
  5. Click Confirm Insert.
  6. Switch over to your Streaming Push Topics browser window. You’ll see a notification that the invoice statement was created. The notification returns the Id, Status__c, and Description__c fields that you defined in the SELECT statement of your PushTopic query. The message looks something like this:
    1{
    2  "channel": "/topic/InvoiceStatementUpdates",
    3  "data": {
    4    "event": {
    5      "type": "created",
    6      "createdDate": "2011-11-14T17:33:45.000+0000"
    7    },
    8    "sobject": {
    9      "Name": "INV-0004",
    10      "Id": "a00D0000008oLi8IAE",
    11      "Description__c": "Test invoice statement",
    12      "Status__c": "Open"
    13    }
    14  }
    15}