Here's a diagram showing how the library is working at the moment (embedding doesn't work properly in Blogger since it is HTML rather than XHTML :( )
As you can see, the application doesn't need to bother doing much. It creates a PubSubClient object like so:
self.client = pubsubclient.PubSubClient("warbo@jabber.org", "I'mnotgivingoutmypassword")
Then connects to the server:
self.client.connect()
Now it can run any methods it likes, for example:
self.client.subscribe_to_node('blogger.com', 'seriously-this-is-not-worth-reading')
This way, however, the program will not receive any notification when a reply comes back. To handle a reply, a function must be passed to the method. For example:
def subscription_replied(self):
self.replied = True
self.client.subscribe_to_node('blogger.com', 'seriously-this-is-not-worth-reading', subscription_replied)
At the moment the callback method doesn't have any arguments (the 'self' argument is special in Python and isn't given when the method is run). This might change, but I would prefer to do it in a generic way which I can't think how to do at the moment. To send data from the library to the application there is an XML tree called server_properties in the PubSubClient class, but I would like to make some getter and setter methods when the core functionality is done.
Tuesday, 22 July 2008
PubSub Library Diagram
Here's a diagram showing how the library is working at the moment (embedding doesn't work properly in Blogger since it is HTML rather than XHTML :( )
As you can see, the application doesn't need to bother doing much. It creates a PubSubClient object like so:
self.client = pubsubclient.PubSubClient("warbo@jabber.org", "I'mnotgivingoutmypassword")
Then connects to the server:
self.client.connect()
Now it can run any methods it likes, for example:
self.client.subscribe_to_node('blogger.com', 'seriously-this-is-not-worth-reading')
This way, however, the program will not receive any notification when a reply comes back. To handle a reply, a function must be passed to the method. For example:
def subscription_replied(self):
self.replied = True
self.client.subscribe_to_node('blogger.com', 'seriously-this-is-not-worth-reading', subscription_replied)
At the moment the callback method doesn't have any arguments (the 'self' argument is special in Python and isn't given when the method is run). This might change, but I would prefer to do it in a generic way which I can't think how to do at the moment. To send data from the library to the application there is an XML tree called server_properties in the PubSubClient class, but I would like to make some getter and setter methods when the core functionality is done.
As you can see, the application doesn't need to bother doing much. It creates a PubSubClient object like so:
self.client = pubsubclient.PubSubClient("warbo@jabber.org", "I'mnotgivingoutmypassword")
Then connects to the server:
self.client.connect()
Now it can run any methods it likes, for example:
self.client.subscribe_to_node('blogger.com', 'seriously-this-is-not-worth-reading')
This way, however, the program will not receive any notification when a reply comes back. To handle a reply, a function must be passed to the method. For example:
def subscription_replied(self):
self.replied = True
self.client.subscribe_to_node('blogger.com', 'seriously-this-is-not-worth-reading', subscription_replied)
At the moment the callback method doesn't have any arguments (the 'self' argument is special in Python and isn't given when the method is run). This might change, but I would prefer to do it in a generic way which I can't think how to do at the moment. To send data from the library to the application there is an XML tree called server_properties in the PubSubClient class, but I would like to make some getter and setter methods when the core functionality is done.
PubSub Library Diagram
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment