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
Conversation
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']); |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
Switch to autoloading instead of using require_once calls
Lots of good stuff overall for this release |
Changes in #35 |
Event buffer changes
@zimbatm @leggetter Do you consider this pull request as a breaking change? |
@vinkla Exceptions are now thrown when unexpected HTTP status codes are returned from the HTTP API. Many of the functions just used to return 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. |
@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. |
@vinkla 👍 |
We are not going to release the feature that this PR was designed to support. |
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_idvalues 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
andpost
now use internalrequest
functionto share common functionality.
get
andpost
return a more “raw” responsethat exposes a) response status code b) response body