Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix callback - pass back domain and subscriber id.

  • Loading branch information...
commit 07f3f0bf9aca41805bcb3e221e8e23c1d6fa7d10 1 parent 5d33f64
Alex Barth authored
Showing with 7 additions and 5 deletions.
  1. +1 −1  PuSHSubscriber.inc
  2. +6 −4 README.markdown
View
2  PuSHSubscriber.inc
@@ -122,7 +122,7 @@ class PuSHSubscriber {
// No subscription notification has ben sent, we are being notified.
else {
if ($raw = $this->receive()) {
- $callback($raw);
+ $callback($raw, $this->domain, $this->subscriber_id);
}
}
}
View
10 README.markdown
@@ -22,21 +22,23 @@ PuSHSubscriberEnvironmentInterface (see PuSHSubscriber.inc).
2) Create a new path in the host application that is unique for every
subscription. For example:
- (http://mysite.com/)pubsub/[subscription_id]
+ (http://mysite.com/)pubsub/[subscriber_id]
3) In the callback for the new path invoke the subscriber's request handler:
// MySubscription and MyEnvironment are the interfaces implemented in 1)
function my_pubsub_page($subscription_id) {
- $sub = PuSHSubscriber::instance('my_subs', $subscription_id, 'MySubscription', new MyEnvironment());
+ $domain = 'my_subs';
+ $sub = PuSHSubscriber::instance($domain, $subscriber_id, 'MySubscription', new MyEnvironment());
$sub->handleRequest('my_pubsub_notification');
}
4) Note the 'my_pubsub_notification' passed to the request handler? This is
the callback that will be invoked if a notification has been received:
- function my_pubsub_notification($raw) {
- // Parse and store the changed items.
+ function my_pubsub_notification($raw, $domain, $subscriber_id) {
+ // Parse $raw and store the changed items for the subscription identified
+ // by $domain and $subscriber_id
}
Please sign in to comment.
Something went wrong with that request. Please try again.