1 | dojo.provide("dojox.cometd.HttpChannels"); |
---|
2 | |
---|
3 | dojo.require("dojox.io.httpParse"); |
---|
4 | dojo.require("dojox.cometd.RestChannels"); |
---|
5 | // Note that cometd _base is _not_ required, this can run standalone, but ifyou want |
---|
6 | // cometd functionality, you must explicitly load/require it elsewhere, and cometd._base |
---|
7 | // MUST be loaded prior to HttpChannels ifyou use it. |
---|
8 | |
---|
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 | |
---|
14 | // description: |
---|
15 | // This can be used: |
---|
16 | // 1. As a cometd transport |
---|
17 | // 2. As an enhancement for the REST RPC service, to enable "live" data (real-time updates directly alter the data in indexes) |
---|
18 | // 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. |
---|
19 | // 3. As a standalone transport. To use it as a standalone transport looks like this: |
---|
20 | // | dojox.cometd.HttpChannels.open(); |
---|
21 | // | dojox.cometd.HttpChannels.get("/myResource",{callback:function(){ |
---|
22 | // | // this is called when the resource is first retrieved and any time the |
---|
23 | // | // resource is changed in the future. This provides a means for retrieving a |
---|
24 | // | // resource and subscribing to it in a single request |
---|
25 | // | }); |
---|
26 | // | dojox.cometd.HttpChannels.subscribe("/anotherResource",{callback:function(){ |
---|
27 | // | // this is called when the resource is changed in the future |
---|
28 | // | }); |
---|
29 | // Channels HTTP can be configured to a different delays: |
---|
30 | // | dojox.cometd.HttpChannels.autoReconnectTime = 60000; // reconnect after one minute |
---|
31 | // |
---|
32 | dojox.cometd.HttpChannels = dojox.cometd.RestChannels; |
---|