I think greg could help you with that when he gets around to reading the list.
There is also a python version and a perl version in the works. I'm
working on the perl version, and will post a how-to when it's ready.
Cheers!
David
On 11/2/06, Dan Scholten <djsch...@mitre.org> wrote:
>
svn co http://svn.xantus.org/shortbus/trunk/cometd-twisted
...
cd cometd-twisted
and then run the "setup_dependencies.sh" script that that's included.
I'll wget, unpack, and set up the various twiddly python bits that you
need to run cometd.
After that, cd back into the cometd-twisted directory and type:
twistd -noy cometd.tac
and point a browser at:
localhost:8080/tests/magnets/magnets.html
Regards
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google
> Groups "cometd-users" group. To post to this group, send email to
> cometd...@googlegroups.com To unsubscribe from this group, send
> email to cometd-users...@googlegroups.com For more options,
> visit this group at http://groups.google.com/group/cometd-users
>
> Visit the cometd website at http://www.cometd.com/
> -~----------~----~----~----~------~----~------~--~---
--
Alex Russell
al...@sitepen.com A99F 8785 F491 D5FD 04D7 ACD9 4158 FFDF 2894 6876
al...@dojotoolkit.org BE03 E88D EABB 2116 CC49 8259 CF78 E242 59C3 9723
OK, I did that, and it works, wow, pretty cool!
I am seeing an exception, <type 'exceptions.KeyError'>:
u'/meta/subscribe'. Anything to worry about?
$ twistd -noy cometd.tac
2006/11/06 12:19 EST [-] Log opened.
2006/11/06 12:19 EST [-] twistd 2.4.0 (/usr/local/bin/python 2.5.0)
starting up
2006/11/06 12:19 EST [-] reactor class: <class
'twisted.internet.selectreactor.SelectReactor'>
2006/11/06 12:19 EST [-] Loading cometd.tac...
2006/11/06 12:19 EST [-]
/usr/local/lib/python2.5/site-packages/simplejson-1.4-py2.5.egg/simplejson/scanner.py:6:
<type 'exceptions.DeprecationWarning'>: The sre module is deprecated,
please import re.
2006/11/06 12:19 EST [-] Log opened.
2006/11/06 12:19 EST [-] Loaded.
2006/11/06 12:19 EST [-] twisted.web2.channel.http.HTTPFactory starting
on 8080
2006/11/06 12:19 EST [-] Starting factory
<twisted.web2.channel.http.HTTPFactory instance at 0xb779aeac>
2006/11/06 12:19 EST [HTTPChannel,0,127.0.0.1] Exception rendering:
2006/11/06 12:19 EST [HTTPChannel,0,127.0.0.1] Traceback (most recent
call last):
File
"/usr/local/lib/python2.5/site-packages/twisted/internet/defer.py",
line 637, in gotResult
_deferGenerator(g, deferred)
File
"/usr/local/lib/python2.5/site-packages/twisted/internet/defer.py",
line 615, in _deferGenerator
deferred.callback(result)
File
"/usr/local/lib/python2.5/site-packages/twisted/internet/defer.py",
line 229, in callback
self._startRunCallbacks(result)
File
"/usr/local/lib/python2.5/site-packages/twisted/internet/defer.py",
line 294, in _startRunCallbacks
self._runCallbacks()
--- <exception caught here> ---
File
"/usr/local/lib/python2.5/site-packages/twisted/internet/defer.py",
line 307, in _runCallbacks
self.result = callback(self.result, *args, **kw)
File
"/usr/local/lib/python2.5/site-packages/twisted/web2/resource.py", line
215, in <lambda>
lambda res: self.render(request))
File "/mnt/data/in/shortbus/trunk/cometd-twisted/cometd.py",
line 436, in render
resp.append(self.route(request, m))
File "/mnt/data/in/shortbus/trunk/cometd-twisted/cometd.py",
line 616, in route
subs = root[message["channel"]]
<type 'exceptions.KeyError'>: u'/meta/subscribe'
function serverMagnetMoveStart(msg){
if(msg.data.source != cometd.clientId){
dojo.widget.byId(msg.data.widgetId).highlight();
}
}
Looks like you really aren't writing any data back through this channel
to the server side in any of these functions. You're just checking the
source of the incoming request. I understand why there is no supporting
server-side robustness, but this raises some questions for me.
If I had a server-side method called 'getPhrasesFromDB()' ,which had to
be invoked to populate the data structure for the dojo 'addMagnets()
function you call, how would I invoke this through CometD? Are all
messages going both ways JSON-formatted, or do I have choices? What
would the front end and back end code look like if addMagnets() called
getPhrasesFromMagnets()? How do I register getPhrasesFromMagnets() on
the server side, with CometD, so the front end knows of it's existence?
What CometD method do I invoke to write the JSON result back to the
front end?
Thank you in advance for your help,
Gloria
Thanks,
Bob
(1) Replace dojo.setModulePrefix by dojo.registerModulePath
(2) The first argument of dojo.widget.createWidget should be
"dojofun:Magnet", not "Magnet".
With these little changes, the demo works fine!!
Cheers!
Bob