You need to sign in to do that
Don't have an account?
apex_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.
thanks !!
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)
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)
Also to clarify, it is not an error. It is for info only.
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....
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..
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
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.
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"
If there is confusion about which versions of the cometd javascript libraries are supported, I know these to work:
https://raw.github.com/gwestersfdc/StreamingLab/master/src/staticresources/common_cometd_js.resource
https://raw.github.com/gwestersfdc/StreamingLab/master/src/staticresources/cometd_js.resource
The two above are required. You can also pair them with the dojo or jquery flavors if you prefer that syntax:
https://raw.github.com/gwestersfdc/StreamingLab/master/src/staticresources/dojo_cometd_js.resource
https://raw.github.com/gwestersfdc/StreamingLab/master/src/staticresources/jquery_cometd_js.resource