WWW::Pusher - Interface to the Pusher WebSockets API


version 0.0701


    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');


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'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.


Squeeks, <squeek at>

JT Smith <rizen at>


Please report bugs to the tracker on GitHub:


You can find documentation for this module with the perldoc command.

    perldoc WWW::Pusher

More information at:


Pusher -


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 for more information.