NAME
WWW::Pusher - Interface to the Pusher WebSockets API
VERSION
version 0.0701
SYNOPSIS
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');
METHODS
new(auth_key => $auth_key, secret => $secret, app_id => $app_id, channel => $channel_id)
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.
trigger(event => $event_name, data => $data, [channel => $channel, socket_id => $socket_id, debug => 1])
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.
socket_auth(socket_id => $socket_id, channel => $channel)
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_auth(socket_id => $socket_id, user_id => $user_id, channel => $channel, user=_info => {name => $name, email => $email})
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.
AUTHOR
Squeeks, <squeek at cpan.org>
JT Smith <rizen at cpan.org>
BUGS
Please report bugs to the tracker on GitHub: https://github.com/rizen/WWW-Pusher/issues
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc WWW::Pusher
More information at: https://github.com/rizen/WWW-Pusher
SEE ALSO
Pusher - http://pusherapp.com
LICENSE AND COPYRIGHT
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.