WWW::Pusher - Interface to the Pusher WebSockets API
use WWW::Pusher; my $pusher = WWW::Pusher->new( auth_key => 'YOUR API KEY', secret => 'YOUR SECRET', app_id => 'YOUR APP ID', channel => 'test_channel' ); my $response = $pusher->trigger(event => 'my_event', data => 'Hello, World!'); my $sock_auth = $pusher->socket_auth('socket_auth_key');
Creates a new WWW::Pusher object. All fields excluding the channel are mandatory, however if you do not set the channel name during construction you must specify it when calling any other method.
You can optionally specify the host and port keys and override using pusherapp.com's server if you wish. In addtion, setting debug to a true value will return an LWP::UserAgent response on any request.
Send an event to the specified channel. The event name should be a scalar, but data can also be hash/arrayref. There should be no need to JSON encode your data.
Returns true on success, or undef on failure. Setting "debug" to a true value will return an LWP::UserAgent response object.
In order to establish private channels, your end must hand back a checksummed bit of data that browsers will, in turn will pass onto the pusher servers. On success this will return a JSON encoded hashref for you to give back to the client. Specifying the channel is optional only if you did not specify it during construction.
Presence signing is exactly like socket ID signing above, only we can include very user-specific data in addition, such as a user ID, name or email. This method generates the signed payload to pass back to Pusher.
The socket ID and user ID are mandatory, however both the channel and user info are not. Setting the channel to undef will default to using the channel defined in the WWW::Pusher object.
<squeek at cpan.org>
<rizen at cpan.org>
Please report bugs to the tracker on GitHub: https://github.com/rizen/WWW-Pusher/issues
You can find documentation for this module with the perldoc command.
More information at: https://github.com/rizen/WWW-Pusher
Pusher - http://pusherapp.com
Copyright 2010 Squeeks.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.