The Subscriber class provides a mechanisme for subscribing to server events. More...
Public Member Functions | |
| def | __init__ |
| Creates a new Subscriber object from the given session and with 'parent' as QObject parent. | |
| def | subscribe |
| Subscribes to the given 'expression' event on the server. | |
| def | unsubscribe |
| Unsubscribes from the previously subscribed event. | |
The Subscriber class provides a mechanisme for subscribing to server events.
In order to use this class effectively you'll need the koo module installed on the server. This module adds a new /subscription service. You can use this class in conjunction with your own server modules which can publish events. By default, the koo module already publishes events on any update/create/delete operation on a model.
If the 'koo' module is not installed the Subscription service won't emit any signals, but won't return any errors either.
Example of usage:
self.subscriber = Rpc.Subscriber(Rpc.session, self) self.subscriber.subscribe( 'updated_model:res.request', self.updateRequestsStatus )
This example will emit a signal (call self.updateRequestsStatus) each time a changed occurs on any record in 'res.request' model.
Definition at line 49 of file Subscriber.py.
| def Koo::Rpc::Subscriber::Subscriber::__init__ | ( | self, | ||
| session, | ||||
parent = None | ||||
| ) |
Creates a new Subscriber object from the given session and with 'parent' as QObject parent.
Definition at line 51 of file Subscriber.py.
| def Koo::Rpc::Subscriber::Subscriber::subscribe | ( | self, | ||
| expression, | ||||
slot = None | ||||
| ) |
Subscribes to the given 'expression' event on the server.
And calls 'slot' each time the given event is published.
Definition at line 58 of file Subscriber.py.
| def Koo::Rpc::Subscriber::Subscriber::unsubscribe | ( | self | ) |
Unsubscribes from the previously subscribed event.
If subscribe() wasn't previously called, nothing happens.
Definition at line 68 of file Subscriber.py.