ステップ 5: PushTopic チャネルをテストする
- Visualforce ページを Web ブラウザに読み込むには、Visualforce ページエディタで [プレビュー] をクリックします。
- テキストボックスに、チャネル名「/topic/InvoiceStatementUpdates」を入力します。
- チャネルに登録するには、[登録] をクリックします。
-
別のブラウザタブで請求書明細を作成または変更します。ページに、デバッグメッセージとイベント通知が表示されます。出力は次のようになります。
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_____________デバッグメッセージには、登録状況に関する情報が含まれます。最初のイベント通知は、InvoiceStatement レコードが作成されたときの通知データを示します。2 つ目の通知は、InvoiceStatement レコードが更新されたときの通知データを示します。
[登録解除] をクリックして、チャネルから登録解除し、通知の受信を停止します。