HttpChannels.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // wrapped by build app
  2. define("dojox/cometd/HttpChannels", ["dijit","dojo","dojox","dojo/require!dojox/io/httpParse,dojox/cometd/RestChannels"], function(dijit,dojo,dojox){
  3. dojo.provide("dojox.cometd.HttpChannels");
  4. dojo.require("dojox.io.httpParse");
  5. dojo.require("dojox.cometd.RestChannels");
  6. // Note that cometd _base is _not_ required, this can run standalone, but ifyou want
  7. // cometd functionality, you must explicitly load/require it elsewhere, and cometd._base
  8. // MUST be loaded prior to HttpChannels ifyou use it.
  9. // summary:
  10. // HttpChannels - An HTTP Based approach to Comet transport with full HTTP messaging
  11. // semantics including REST. HttpChannels is exactly the same as RestChannels, loading HttpChannels simply ensures that http parsing
  12. // capabilities are present for application/http messages
  13. // description:
  14. // This can be used:
  15. // 1. As a cometd transport
  16. // 2. As an enhancement for the REST RPC service, to enable "live" data (real-time updates directly alter the data in indexes)
  17. // 2a. With the JsonRestStore (which is driven by the REST RPC service), so this dojo.data has real-time data. Updates can be heard through the dojo.data notification API.
  18. // 3. As a standalone transport. To use it as a standalone transport looks like this:
  19. // | dojox.cometd.HttpChannels.open();
  20. // | dojox.cometd.HttpChannels.get("/myResource",{callback:function(){
  21. // | // this is called when the resource is first retrieved and any time the
  22. // | // resource is changed in the future. This provides a means for retrieving a
  23. // | // resource and subscribing to it in a single request
  24. // | });
  25. // | dojox.cometd.HttpChannels.subscribe("/anotherResource",{callback:function(){
  26. // | // this is called when the resource is changed in the future
  27. // | });
  28. // Channels HTTP can be configured to a different delays:
  29. // | dojox.cometd.HttpChannels.autoReconnectTime = 60000; // reconnect after one minute
  30. //
  31. dojox.cometd.HttpChannels = dojox.cometd.RestChannels;
  32. });