cometd-rails 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +202 -0
  5. data/README.md +39 -0
  6. data/Rakefile +2 -0
  7. data/cometd-rails.gemspec +23 -0
  8. data/lib/cometd/rails/version.rb +5 -0
  9. data/lib/cometd/rails.rb +18 -0
  10. data/vendor/assets/javascripts/.DS_Store +0 -0
  11. data/vendor/assets/javascripts/cometd-dojox-rails.js +2 -0
  12. data/vendor/assets/javascripts/cometd-jquery-rails.js +2 -0
  13. data/vendor/assets/javascripts/common/.DS_Store +0 -0
  14. data/vendor/assets/javascripts/common/AckExtension.js +112 -0
  15. data/vendor/assets/javascripts/common/CallbackPollingTransport.js +166 -0
  16. data/vendor/assets/javascripts/common/CometD.js +2090 -0
  17. data/vendor/assets/javascripts/common/LongPollingTransport.js +111 -0
  18. data/vendor/assets/javascripts/common/ReloadExtension.js +254 -0
  19. data/vendor/assets/javascripts/common/RequestTransport.js +297 -0
  20. data/vendor/assets/javascripts/common/TimeStampExtension.js +42 -0
  21. data/vendor/assets/javascripts/common/TimeSyncExtension.js +216 -0
  22. data/vendor/assets/javascripts/common/Transport.js +142 -0
  23. data/vendor/assets/javascripts/common/TransportRegistry.js +116 -0
  24. data/vendor/assets/javascripts/common/Utils.js +58 -0
  25. data/vendor/assets/javascripts/common/WebSocketTransport.js +410 -0
  26. data/vendor/assets/javascripts/common/cometd-amd.js +7 -0
  27. data/vendor/assets/javascripts/common/cometd-header.js +15 -0
  28. data/vendor/assets/javascripts/common/cometd-json.js +5 -0
  29. data/vendor/assets/javascripts/common/cometd-namespace.js +3 -0
  30. data/vendor/assets/javascripts/common/cometd.require.js +16 -0
  31. data/vendor/assets/javascripts/dojox/.DS_Store +0 -0
  32. data/vendor/assets/javascripts/dojox/ack.js +22 -0
  33. data/vendor/assets/javascripts/dojox/dojox.require.js +5 -0
  34. data/vendor/assets/javascripts/dojox/main.js +95 -0
  35. data/vendor/assets/javascripts/dojox/reload.js +26 -0
  36. data/vendor/assets/javascripts/dojox/timestamp.js +22 -0
  37. data/vendor/assets/javascripts/dojox/timesync.js +22 -0
  38. data/vendor/assets/javascripts/jquery/.DS_Store +0 -0
  39. data/vendor/assets/javascripts/jquery/jquery.cometd-ack.js +33 -0
  40. data/vendor/assets/javascripts/jquery/jquery.cometd-reload.js +41 -0
  41. data/vendor/assets/javascripts/jquery/jquery.cometd-timestamp.js +33 -0
  42. data/vendor/assets/javascripts/jquery/jquery.cometd-timesync.js +33 -0
  43. data/vendor/assets/javascripts/jquery/jquery.cometd.js +140 -0
  44. data/vendor/assets/javascripts/jquery/jquery.cometd.require.js +5 -0
  45. metadata +115 -0
@@ -0,0 +1,410 @@
1
+ org.cometd.WebSocketTransport = function()
2
+ {
3
+ var _super = new org.cometd.Transport();
4
+ var _self = org.cometd.Transport.derive(_super);
5
+ var _cometd;
6
+ // By default WebSocket is supported
7
+ var _webSocketSupported = true;
8
+ // Whether we were able to establish a WebSocket connection
9
+ var _webSocketConnected = false;
10
+ var _stickyReconnect = true;
11
+ // Envelopes that have been sent
12
+ var _envelopes = {};
13
+ // Timeouts for messages that have been sent
14
+ var _timeouts = {};
15
+ var _connecting = false;
16
+ var _webSocket = null;
17
+ var _connected = false;
18
+ var _successCallback = null;
19
+
20
+ _self.reset = function()
21
+ {
22
+ _super.reset();
23
+ _webSocketSupported = true;
24
+ _webSocketConnected = false;
25
+ _stickyReconnect = true;
26
+ _envelopes = {};
27
+ _timeouts = {};
28
+ _connecting = false;
29
+ _connected = false;
30
+ };
31
+
32
+ function _websocketConnect()
33
+ {
34
+ // We may have multiple attempts to open a WebSocket
35
+ // connection, for example a /meta/connect request that
36
+ // may take time, along with a user-triggered publish.
37
+ // Early return if we are connecting.
38
+ if (_connecting)
39
+ {
40
+ return;
41
+ }
42
+
43
+ _connecting = true;
44
+
45
+ // Mangle the URL, changing the scheme from 'http' to 'ws'.
46
+ var url = _cometd.getURL().replace(/^http/, 'ws');
47
+ this._debug('Transport', this.getType(), 'connecting to URL', url);
48
+
49
+ try
50
+ {
51
+ var protocol = _cometd.getConfiguration().protocol;
52
+ var webSocket = protocol ? new org.cometd.WebSocket(url, protocol) : new org.cometd.WebSocket(url);
53
+ }
54
+ catch (x)
55
+ {
56
+ _webSocketSupported = false;
57
+ this._debug('Exception while creating WebSocket object', x);
58
+ throw x;
59
+ }
60
+
61
+ // By default use sticky reconnects.
62
+ _stickyReconnect = _cometd.getConfiguration().stickyReconnect !== false;
63
+
64
+ var self = this;
65
+ var connectTimer = null;
66
+ var connectTimeout = _cometd.getConfiguration().connectTimeout;
67
+ if (connectTimeout > 0)
68
+ {
69
+ connectTimer = this.setTimeout(function()
70
+ {
71
+ connectTimer = null;
72
+ self._debug('Transport', self.getType(), 'timed out while connecting to URL', url, ':', connectTimeout, 'ms');
73
+ // The connection was not opened, close anyway.
74
+ var event = { code: 1000, reason: 'Connect Timeout' };
75
+ self.webSocketClose(webSocket, event.code, event.reason);
76
+ // Force immediate failure of pending messages to trigger reconnect.
77
+ // This is needed because the server may not reply to our close()
78
+ // and therefore the onclose function is never called.
79
+ self.onClose(webSocket, event);
80
+ }, connectTimeout);
81
+ }
82
+
83
+ var onopen = function()
84
+ {
85
+ self._debug('WebSocket opened', webSocket);
86
+ _connecting = false;
87
+ if (connectTimer)
88
+ {
89
+ self.clearTimeout(connectTimer);
90
+ connectTimer = null;
91
+ }
92
+
93
+ if (_webSocket)
94
+ {
95
+ // We have a valid connection already, close this one.
96
+ _cometd._warn('Closing Extra WebSocket Connections', webSocket, _webSocket);
97
+ // Closing will eventually trigger onclose(), but
98
+ // we do not want to clear outstanding messages.
99
+ self.webSocketClose(webSocket, 1000, 'Extra Connection');
100
+ }
101
+ else
102
+ {
103
+ self.onOpen(webSocket);
104
+ }
105
+ };
106
+ // This callback is invoked when the server sends the close frame.
107
+ var onclose = function(event)
108
+ {
109
+ event = event || { code: 1000 };
110
+ self._debug('WebSocket closing', webSocket, event);
111
+ _connecting = false;
112
+ if (connectTimer)
113
+ {
114
+ self.clearTimeout(connectTimer);
115
+ connectTimer = null;
116
+ }
117
+
118
+ if (_webSocket !== null && webSocket !== _webSocket)
119
+ {
120
+ // We closed an extra WebSocket object that
121
+ // we may have created during reconnection.
122
+ self._debug('Closed Extra WebSocket Connection', webSocket);
123
+ }
124
+ else
125
+ {
126
+ self.onClose(webSocket, event);
127
+ }
128
+ };
129
+ var onmessage = function(message)
130
+ {
131
+ self._debug('WebSocket message', message, webSocket);
132
+ if (webSocket !== _webSocket)
133
+ {
134
+ _cometd._warn('Extra WebSocket Connections', webSocket, _webSocket);
135
+ }
136
+ self.onMessage(webSocket, message);
137
+ };
138
+
139
+ webSocket.onopen = onopen;
140
+ webSocket.onclose = onclose;
141
+ webSocket.onerror = function()
142
+ {
143
+ // Clients should call onclose(), but if they do not we do it here for safety.
144
+ onclose({ code: 1002, reason: 'Error' });
145
+ };
146
+ webSocket.onmessage = onmessage;
147
+
148
+ this._debug('Transport', this.getType(), 'configured callbacks on', webSocket);
149
+ }
150
+
151
+ function _webSocketSend(webSocket, envelope, metaConnect)
152
+ {
153
+ var json = org.cometd.JSON.toJSON(envelope.messages);
154
+
155
+ webSocket.send(json);
156
+ this._debug('Transport', this.getType(), 'sent', envelope, 'metaConnect =', metaConnect);
157
+
158
+ // Manage the timeout waiting for the response.
159
+ var maxDelay = this.getConfiguration().maxNetworkDelay;
160
+ var delay = maxDelay;
161
+ if (metaConnect)
162
+ {
163
+ delay += this.getAdvice().timeout;
164
+ _connected = true;
165
+ }
166
+
167
+ var self = this;
168
+ var messageIds = [];
169
+ for (var i = 0; i < envelope.messages.length; ++i)
170
+ {
171
+ (function()
172
+ {
173
+ var message = envelope.messages[i];
174
+ if (message.id)
175
+ {
176
+ messageIds.push(message.id);
177
+ _timeouts[message.id] = this.setTimeout(function()
178
+ {
179
+ self._debug('Transport', self.getType(), 'timing out message', message.id, 'after', delay, 'on', webSocket);
180
+ var event = { code: 1000, reason: 'Message Timeout' };
181
+ self.webSocketClose(webSocket, event.code, event.reason);
182
+ // Force immediate failure of pending messages to trigger reconnect.
183
+ // This is needed because the server may not reply to our close()
184
+ // and therefore the onclose function is never called.
185
+ self.onClose(webSocket, event);
186
+ }, delay);
187
+ }
188
+ })();
189
+ }
190
+
191
+ this._debug('Transport', this.getType(), 'waiting at most', delay, 'ms for messages', messageIds, 'maxNetworkDelay', maxDelay, ', timeouts:', _timeouts);
192
+ }
193
+
194
+ function _send(webSocket, envelope, metaConnect)
195
+ {
196
+ try
197
+ {
198
+ if (webSocket === null)
199
+ {
200
+ _websocketConnect.call(this);
201
+ }
202
+ else
203
+ {
204
+ _webSocketSend.call(this, webSocket, envelope, metaConnect);
205
+ }
206
+ }
207
+ catch (x)
208
+ {
209
+ // Keep the semantic of calling response callbacks asynchronously after the request.
210
+ this.setTimeout(function()
211
+ {
212
+ envelope.onFailure(webSocket, envelope.messages, {
213
+ exception: x
214
+ });
215
+ }, 0);
216
+ }
217
+ }
218
+
219
+ _self.onOpen = function(webSocket)
220
+ {
221
+ this._debug('Transport', this.getType(), 'opened', webSocket);
222
+ _webSocket = webSocket;
223
+ _webSocketConnected = true;
224
+
225
+ this._debug('Sending pending messages', _envelopes);
226
+ for (var key in _envelopes)
227
+ {
228
+ var element = _envelopes[key];
229
+ var envelope = element[0];
230
+ var metaConnect = element[1];
231
+ // Store the success callback, which is independent from the envelope,
232
+ // so that it can be used to notify arrival of messages.
233
+ _successCallback = envelope.onSuccess;
234
+ _webSocketSend.call(this, webSocket, envelope, metaConnect);
235
+ }
236
+ };
237
+
238
+ _self.onMessage = function(webSocket, wsMessage)
239
+ {
240
+ this._debug('Transport', this.getType(), 'received websocket message', wsMessage, webSocket);
241
+
242
+ var close = false;
243
+ var messages = this.convertToMessages(wsMessage.data);
244
+ var messageIds = [];
245
+ for (var i = 0; i < messages.length; ++i)
246
+ {
247
+ var message = messages[i];
248
+
249
+ // Detect if the message is a response to a request we made.
250
+ // If it's a meta message, for sure it's a response; otherwise it's
251
+ // a publish message and publish responses don't have the data field.
252
+ if (/^\/meta\//.test(message.channel) || message.data === undefined)
253
+ {
254
+ if (message.id)
255
+ {
256
+ messageIds.push(message.id);
257
+
258
+ var timeout = _timeouts[message.id];
259
+ if (timeout)
260
+ {
261
+ this.clearTimeout(timeout);
262
+ delete _timeouts[message.id];
263
+ this._debug('Transport', this.getType(), 'removed timeout for message', message.id, ', timeouts', _timeouts);
264
+ }
265
+ }
266
+ }
267
+
268
+ if ('/meta/connect' === message.channel)
269
+ {
270
+ _connected = false;
271
+ }
272
+ if ('/meta/disconnect' === message.channel && !_connected)
273
+ {
274
+ close = true;
275
+ }
276
+ }
277
+
278
+ // Remove the envelope corresponding to the messages.
279
+ var removed = false;
280
+ for (var j = 0; j < messageIds.length; ++j)
281
+ {
282
+ var id = messageIds[j];
283
+ for (var key in _envelopes)
284
+ {
285
+ var ids = key.split(',');
286
+ var index = org.cometd.Utils.inArray(id, ids);
287
+ if (index >= 0)
288
+ {
289
+ removed = true;
290
+ ids.splice(index, 1);
291
+ var envelope = _envelopes[key][0];
292
+ var metaConnect = _envelopes[key][1];
293
+ delete _envelopes[key];
294
+ if (ids.length > 0)
295
+ {
296
+ _envelopes[ids.join(',')] = [envelope, metaConnect];
297
+ }
298
+ break;
299
+ }
300
+ }
301
+ }
302
+ if (removed)
303
+ {
304
+ this._debug('Transport', this.getType(), 'removed envelope, envelopes', _envelopes);
305
+ }
306
+
307
+ _successCallback.call(this, messages);
308
+
309
+ if (close)
310
+ {
311
+ this.webSocketClose(webSocket, 1000, 'Disconnect');
312
+ }
313
+ };
314
+
315
+ _self.onClose = function(webSocket, event)
316
+ {
317
+ this._debug('Transport', this.getType(), 'closed', webSocket, event);
318
+
319
+ // Remember if we were able to connect
320
+ // This close event could be due to server shutdown,
321
+ // and if it restarts we want to try websocket again.
322
+ _webSocketSupported = _stickyReconnect && _webSocketConnected;
323
+
324
+ var timeouts = _timeouts;
325
+ _timeouts = {};
326
+ for (var id in timeouts)
327
+ {
328
+ this.clearTimeout(timeouts[id]);
329
+ }
330
+
331
+ var envelopes = _envelopes;
332
+ _envelopes = {};
333
+ for (var key in envelopes)
334
+ {
335
+ var envelope = envelopes[key][0];
336
+ var metaConnect = envelopes[key][1];
337
+ if (metaConnect)
338
+ {
339
+ _connected = false;
340
+ }
341
+ envelope.onFailure(webSocket, envelope.messages, {
342
+ websocketCode: event.code,
343
+ reason: event.reason
344
+ });
345
+ }
346
+
347
+ _webSocket = null;
348
+ };
349
+
350
+ _self.registered = function(type, cometd)
351
+ {
352
+ _super.registered(type, cometd);
353
+ _cometd = cometd;
354
+ };
355
+
356
+ _self.accept = function(version, crossDomain, url)
357
+ {
358
+ // Using !! to return a boolean (and not the WebSocket object).
359
+ return _webSocketSupported && !!org.cometd.WebSocket && _cometd.websocketEnabled !== false;
360
+ };
361
+
362
+ _self.send = function(envelope, metaConnect)
363
+ {
364
+ this._debug('Transport', this.getType(), 'sending', envelope, 'metaConnect =', metaConnect);
365
+
366
+ // Store the envelope in any case; if the websocket cannot be opened, we fail it.
367
+ var messageIds = [];
368
+ for (var i = 0; i < envelope.messages.length; ++i)
369
+ {
370
+ var message = envelope.messages[i];
371
+ if (message.id)
372
+ {
373
+ messageIds.push(message.id);
374
+ }
375
+ }
376
+ _envelopes[messageIds.join(',')] = [envelope, metaConnect];
377
+ this._debug('Transport', this.getType(), 'stored envelope, envelopes', _envelopes);
378
+
379
+ _send.call(this, _webSocket, envelope, metaConnect);
380
+ };
381
+
382
+ _self.webSocketClose = function(webSocket, code, reason)
383
+ {
384
+ try
385
+ {
386
+ webSocket.close(code, reason);
387
+ }
388
+ catch (x)
389
+ {
390
+ this._debug(x);
391
+ }
392
+ };
393
+
394
+ _self.abort = function()
395
+ {
396
+ _super.abort();
397
+ if (_webSocket)
398
+ {
399
+ var event = { code: 1001, reason: 'Abort' };
400
+ this.webSocketClose(_webSocket, event.code, event.reason);
401
+ // Force immediate failure of pending messages to trigger reconnect.
402
+ // This is needed because the server may not reply to our close()
403
+ // and therefore the onclose function is never called.
404
+ this.onClose(_webSocket, event);
405
+ }
406
+ this.reset();
407
+ };
408
+
409
+ return _self;
410
+ };
@@ -0,0 +1,7 @@
1
+ if (typeof define === 'function' && define.amd)
2
+ {
3
+ define(function()
4
+ {
5
+ return org.cometd;
6
+ });
7
+ }
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Copyright (c) 2008-2014 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
@@ -0,0 +1,5 @@
1
+ org.cometd.JSON = {};
2
+ org.cometd.JSON.toJSON = org.cometd.JSON.fromJSON = function(object)
3
+ {
4
+ throw 'Abstract';
5
+ };
@@ -0,0 +1,3 @@
1
+ // Namespaces for the cometd implementation
2
+ this.org = this.org || {};
3
+ org.cometd = {};
@@ -0,0 +1,16 @@
1
+ //= require ./cometd-namespace
2
+ //= require ./CometD
3
+ //= require ./cometd-amd
4
+ //= require ./cometd-header
5
+ //= require ./cometd-json
6
+ //= require ./LongPollingTransport
7
+ //= require ./RequestTransport
8
+ //= require ./Transport
9
+ //= require ./TransportRegistry
10
+ //= require ./Utils
11
+ //= require ./CallbackPollingTransport
12
+ //= require ./WebSocketTransport
13
+ //= require ./AckExtension.js
14
+ //= require ./ReloadExtension.js
15
+ //= require ./TimeStampExtension.js
16
+ //= require ./TimeSyncExtension.js
@@ -0,0 +1,22 @@
1
+ /*
2
+ * Copyright (c) 2008-2014 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ define(['org/cometd/AckExtension', 'dojox/cometd'],
17
+ function(AckExtension, cometd)
18
+ {
19
+ var result = new AckExtension();
20
+ cometd.registerExtension('ack', result);
21
+ return result;
22
+ });
@@ -0,0 +1,5 @@
1
+ //= require ./ack
2
+ //= require ./main
3
+ //= require ./reload
4
+ //= require ./timestamp
5
+ //= require ./timesync
@@ -0,0 +1,95 @@
1
+ /*
2
+ * Copyright (c) 2008-2014 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ define(['org/cometd', 'dojo/json', 'dojox', 'dojo/_base/xhr', 'dojo/request/script'],
17
+ function(org_cometd, JSON, dojox, dojoXHR, dojoSCRIPT)
18
+ {
19
+ // Remap cometd JSON functions to dojo JSON functions
20
+ org_cometd.JSON.toJSON = JSON.stringify;
21
+ org_cometd.JSON.fromJSON = JSON.parse;
22
+
23
+ dojox.CometD = function(name)
24
+ {
25
+ var cometd = new org_cometd.CometD(name);
26
+
27
+ function LongPollingTransport()
28
+ {
29
+ var _super = new org_cometd.LongPollingTransport();
30
+ var that = org_cometd.Transport.derive(_super);
31
+
32
+ that.xhrSend = function(packet)
33
+ {
34
+ var deferred = dojoXHR.post({
35
+ url: packet.url,
36
+ sync: packet.sync === true,
37
+ contentType: 'application/json;charset=UTF-8',
38
+ headers: packet.headers,
39
+ postData: packet.body,
40
+ withCredentials: true,
41
+ handleAs: 'json',
42
+ load: packet.onSuccess,
43
+ error: function(error)
44
+ {
45
+ packet.onError(error.message, deferred ? deferred.ioArgs.error : error);
46
+ }
47
+ });
48
+ return deferred.ioArgs.xhr;
49
+ };
50
+
51
+ return that;
52
+ }
53
+
54
+ function CallbackPollingTransport()
55
+ {
56
+ var _super = new org_cometd.CallbackPollingTransport();
57
+ var that = org_cometd.Transport.derive(_super);
58
+
59
+ that.jsonpSend = function(packet)
60
+ {
61
+ dojoSCRIPT.get(packet.url, {
62
+ jsonp: 'jsonp',
63
+ query: {
64
+ // In callback-polling, the content must be sent via the 'message' parameter
65
+ message: packet.body
66
+ },
67
+ sync: packet.sync === true
68
+ }).then(packet.onSuccess, function (error)
69
+ {
70
+ // Actually never called by Dojo, perhaps a Dojo bug.
71
+ packet.onError(error);
72
+ });
73
+ return undefined;
74
+ };
75
+
76
+ return that;
77
+ }
78
+
79
+ // Registration order is important
80
+ if (org_cometd.WebSocket)
81
+ {
82
+ cometd.registerTransport('websocket', new org_cometd.WebSocketTransport());
83
+ }
84
+ cometd.registerTransport('long-polling', new LongPollingTransport());
85
+ cometd.registerTransport('callback-polling', new CallbackPollingTransport());
86
+
87
+ return cometd;
88
+ };
89
+
90
+ // The default cometd instance
91
+ var cometd = new dojox.CometD();
92
+ dojox.cometd = cometd;
93
+
94
+ return cometd;
95
+ });
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Copyright (c) 2008-2014 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ define(['org/cometd', 'dojo/cookie', 'org/cometd/ReloadExtension', 'dojox/cometd'],
17
+ function(org_cometd, cookie, ReloadExtension, cometd)
18
+ {
19
+ // Remap cometd COOKIE functions to dojo cookie functions
20
+ org_cometd.COOKIE.set = cookie;
21
+ org_cometd.COOKIE.get = cookie;
22
+
23
+ var result = new ReloadExtension();
24
+ cometd.registerExtension('reload', result);
25
+ return result;
26
+ });
@@ -0,0 +1,22 @@
1
+ /*
2
+ * Copyright (c) 2008-2014 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ define(['org/cometd/TimeStampExtension', 'dojox/cometd'],
17
+ function(TimeStampExtension, cometd)
18
+ {
19
+ var result = new TimeStampExtension();
20
+ cometd.registerExtension('timestamp', result);
21
+ return result;
22
+ });
@@ -0,0 +1,22 @@
1
+ /*
2
+ * Copyright (c) 2008-2014 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ define(['org/cometd/TimeSyncExtension', 'dojox/cometd'],
17
+ function(TimeSyncExtension, cometd)
18
+ {
19
+ var result = new TimeSyncExtension();
20
+ cometd.registerExtension('timesync', result);
21
+ return result;
22
+ });