function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
apex_keenapex_keen 

Error on trying streaming API simple example

I was trying to get idea about streaming APIs. Trying the example given on following salesforce wiki page. 

 

http://wiki.developerforce.com/page/Getting_Started_with_the_Force.com_Streaming_API

 

but its not working . On  using JS console on chrome- getting following error : 

 

"Appending message type to URI /cometd/23.0/ is not supported, disabling 'appendMessageTypeToURL' configuration"

 

Please let me know , if anyone has any idea about it. I've tried to take care all things mentioned in following post. 

 

http://boards.developerforce.com/t5/Streaming-API-Developer-Preview/Error-trying-to-do-the-Visualforce-sample-of-Streaming-Api/td-p/349157

 

thanks !!

 

VM_SFDCVM_SFDC

This message seems to be coming from cometd java script library that you are using.

 

References:

http://cometd.org/book/export/html/3

http://code.google.com/p/ext-cometd/source/browse/trunk/src/main/webapp/js-lib/org/cometd.js?r=6

 

"appendMessageTypeToURL     no     true     Whether or not the Bayeux message type (handshake, connect, disconnect) is appended to URL of the Bayeux server (see above)."

Let us know if you still cannot get it to work.

 

Thanks!

- Vinod.

 

(Salesforce.com)

 

 

VM_SFDCVM_SFDC

To suppress this message set appendMessageTypeToURL : false.

 

Example:

 

        Sfdc.cometd.init({
            url: window.location.protocol+'//'+window.location.hostname+'/cometd/25.0',
            requestHeaders: { Authorization: 'OAuth ' + Ext.util.Cookies.get('sid')},
            appendMessageTypeToURL : false
        });

 

Thanks!

Vinod.

 

(Salesforce.com)

VM_SFDCVM_SFDC

Also to clarify, it is not an error. It is for info only.

apex_keenapex_keen

Thanks vinod for replying back... now that  error ( or it is just info, as you mentioned) is gone ....but still I was not able to make it work. 

 

created push topic from  system log console  in following way : 

PushTopic pushTopic = new PushTopic();
pushTopic.ApiVersion = 23.0;
pushTopic.Name = 'AllAccounts2'; //changed name here as well as in vf page code
pushTopic.Description = 'All records for the Account object';
pushtopic.Query = 'SELECT Id, Name FROM Account';
insert pushTopic;
System.debug('Created new PushTopic: '+ pushTopic.Id);

 

Here ,succesfully able to get back push topic ID....then I created account record .. 

but not getting any data back in vf page....

 

 

sammydsammyd

and I have a topic here with the same problem with a Java client..

 

this section of the java code is wrong for Spring 12..

 

/ The channel to subscribe to. Same as the name of the PushTopic. 
    // Be sure to create this topic before running this sample.
    private static final String CHANNEL = VERSION_22 ? "/AllAccounts" : "/topic/AllAccounts";
    private static final String STREAMING_ENDPOINT_URI = VERSION_22 ? 
        "/cometd" : "/cometd/23.0";

If I add "/topic/" to the front of my created topic "UpdateProblem"
I get a failure in the subscribe.
Subscribing for channel: /topic/updatedProblem'
Waiting for streamed data from your organization ...
[CHANNEL:META_SUBSCRIBE]: {"id":"4","subscription":"/topic/updatedProblem'","error":"400::The topic you requested to subscribe to does not exist {/topic/updatedProblem'}","successful":false,"channel":"/meta/subscribe"}
Error during SUBSCRIBE: 400::The topic you requested to subscribe to does not exist {/topic/updatedProblem'}
Exiting...
ashulmanashulman

Hi sammyd,

 

Would you mind posting your code for creating the pushTopic? Specifically, what the name of the topic is and the API version of the sobject. Also, which salesforce instance is your org on?

 

Best,


Aleks S.

SFDC

VM_SFDCVM_SFDC

I'd suggest let's deal with sammyd's issue in a separate thread (he has been posting on a different thread). Otherwise this thread is going to become confusing. Let's keep this one for apex_keen's issue.

 

Thanks!

Vinod.

Daniph08Daniph08

Hi apex_keen,

 

I followed the "getting started" link you provided and noticed a typo in the tutorial...

 

The sample creates a push topic called "AllAccounts," but the VF page sample subscribes to a push topic called "NewAccounts" (see line 17 of the vf page) If you missed this, the vf page will try to subscribe to a push topic (NewAccounts) that doesn't exist. That would explain why creating an account doesn't get picked up by the vf page. (sorry this example doesn't have error handling)

 

I changed that to subscribe to 'AllAccounts' and the page works for me. see this working sample in my org:

 

username: demo@streaming.salesforce.com

password: 123456

 

I hope that helps!

 

ps. I tested this in firefox and chrome. It should work for both.

 

1. login.

2. open a tab to the Streaming Page: https://c.na12.visual.force.com/apex/StreamingPage

2. open a tab to accounts

3. create an account.

4. you should see the following on the vf page:

 

Notifications should appear here...

Notification: Channel: "/topic/AllAccounts"
Record name: "test"
ID: "001U000000AjpCpIAJ"
Event type: "created"
Created: "2012-02-19T04:25:00.000+0000"

Notification: Channel: "/topic/AllAccounts"
Record name: "test 2"
ID: "001U000000AjpD6IAJ"
Event type: "created"
Created: "2012-02-19T04:28:23.000+0000"