Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event buffer return values and exceptions #31

Closed
wants to merge 23 commits into from
Closed

Conversation

leggetter
Copy link
Contributor

The upcoming event buffer functionality requires
the Pusher::trigger function to expose the event_id
of each event triggered on a channel. In order to
do this the success return value has to be changed
from true to an object that allows the event_id
values to be inspected.

As part of this work the library is also updated
to throw exceptions when any unexpected response
is returned from the Pusher HTTP API.

Additional details:

  • get and post now use internal request function
    to share common functionality.
  • get and post return a more “raw” response
    that exposes a) response status code b) response body

The upcoming event buffer functionality requires
the Pusher::trigger function to expose the event_id
of each event triggered on a channel. In order to
do this the success return value has to be changed
from `true` to an object that allows the event_id
values to be inspected.

As part of this work the library is also updated
to throw exceptions when any unexpected response
is returned from the Pusher HTTP API.

Additional details:

* `get` and `post` now use internal `request` function
to share common functionality.
* `get` and `post` return a more “raw” response
that exposes a) response status code b) response body

```php
// Trigger on single channel
$triggerResult = $pusher.trigger('ch1', 'my-event' ['some' => 'data']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$pusher.trigger is not valid in PHP

/**
* Represents the result of a call to {@link Pusher::trigger}.
*/
class TriggerResult {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep Pusher in class names to avoid conflicts with other libraries (PHP class names must be unique).

The common convention for classes which are not using namespaces is to use underscores as separators (similar to the way namespaces would be used for 5.3+): Pusher_TriggerResult

stof and others added 2 commits March 11, 2015 16:50
@zimbatm
Copy link
Contributor

zimbatm commented Mar 19, 2015

Lots of good stuff overall for this release

@zimbatm
Copy link
Contributor

zimbatm commented Mar 19, 2015

Changes in #35

@vinkla
Copy link
Contributor

vinkla commented Mar 20, 2015

@zimbatm @leggetter Do you consider this pull request as a breaking change?

@leggetter
Copy link
Contributor Author

@vinkla Exceptions are now thrown when unexpected HTTP status codes are returned from the HTTP API. Many of the functions just used to return false.

It also offers brand new functionality. That alone would probably only justify a minor release. But I think combined with the exception throwing justifies a major 3.0 release.

@vinkla
Copy link
Contributor

vinkla commented Mar 20, 2015

@leggetter Thanks for clearing it up. I wanted to know if I should release a major or minor version of my Laravel Pusher package (pusher/pusher-http-laravel#4) when this is merged into master.

@leggetter
Copy link
Contributor Author

@vinkla 👍

@WillSewell
Copy link
Contributor

We are not going to release the feature that this PR was designed to support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants