RE: remote routing questions
"Adam Rifkin" <[email protected]>
| Newsgroups | gmane.comp.web.mod-pubsub.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Jos,
Unfortunately such off-host route sources don't work right now (that is, no one has implemented them yet! :), and JavaScript security doesn't allow a single JavaScript app to use servers in more than one domain.
Instead you'll need to write a tiny "repeater" written in a language other than JavaScript to subscribe to the source topic on mod-pubsub.org and publish to a mirror on your local server.
Perhaps something like the mini-app below, which we wrote using the Python PubSub Client Library. I'll check this into mod_pubsub/python_pubsub/apps/repeater.py for those on the developer list who just want to do a cvs update.
Adam
import pubsublib, scheduler, asyncore
class StatusMonitor:
def onStatus(self, event):
#print "STATUS: " + str(event["status"])
pass
class Repeater(StatusMonitor):
def __init__(self, client):
self.client = client
def onMessage(self, event):
#print "Message: " + event["kn_payload"]
self.client.publish("/what/apps/blogchatter/pings",
event,
StatusMonitor())
ua = pubsublib.HTTPUserAgent()
client1 = pubsublib.SimpleClient(ua, "http://www.mod-pubsub.org:9000/kn")
client2 = pubsublib.SimpleClient(ua, "http://127.0.0.1:8000/kn")
client1.subscribe("/what/apps/blogchatter/pings",
Repeater(client2),
{ "do_max_n": "10" },
StatusMonitor())
while 1:
asyncore.poll(scheduler.timeout())
scheduler.run()
-----Original Message-----
From: hyakugei [mailto:[email protected]]
Sent: Tuesday, June 10, 2003 1:48 PM
To: Adam Rifkin; pubsub
Subject: remote routing questions
Hey all. I'm doing some experimentation now with the javascript pubsub lib. I've gotten it to work fine and dandy on a box with a local copy of the python server running.
What i've been trying to do is create a route between the blogchatter topic on mod-pubsub.org (http://www.mod-pubsub.org/kn/what/apps/blogchatter/pings) and my local connection (say, /who/jos/s/24/kn_journal).
the code i am currently using is like so:
kn.subscribe("http://www.mod-pubsub.org/kn/what/apps/blogchatter/pings", onMessage, {do_max_n:10}, {onSuccess:renderDisplay}));
I know the onMessage and renderDisplay functions work, as i use them to display the /what/chat topic.
Any suggestions?
jos
ps. i just realized that my local box is on a local 10.0.0.x network - this might be the problem...
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.