Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

PusherAS ActionScript3 Client Library using the native AS3 event system. Developed for real-time Mobile, Desktop, Browser applications.

Listed at

###Example Script Demo: alt tag

Live Demo: Note: Open the browser console to inspect log messages.

###Usage: To define the pusher connection, create a new PusherOptions instance. The PusherOptions provides several keys to define the pusher setup, disconnect / interrupt handling. To display log messages from the PusherAS, include the LoggerAS library from into your project.

public function PusherASExample()
    // Setup the LoggerAS logging framework
    LAS.addTarget(new LASTraceTarget());
    // Create pusher options
    var pusherOptions:PusherOptions = new PusherOptions();
    pusherOptions.applicationKey = '7eb5f11xxxxxxxxxxx';
    pusherOptions.auth_endpoint = '';
    pusherOptions.origin = ''; = true;
    pusherOptions.autoPing = true;
    pusherOptions.pingPongBasedDisconnect = true;
    pusherOptions.pingInterval = 750;
    pusherOptions.pingPongTimeout = 15000;
    pusherOptions.interruptTimeout = 2500;
    // Create pusher client and connect to server
    _pusher = new Pusher(pusherOptions);
    _pusher.verboseLogging = true;
    // Pusher event handling
    _pusher.addEventListener(PusherEvent.CONNECTION_ESTABLISHED, pusher_CONNECTION_ESTABLISHED);
    // Pusher websocket event handling
    _pusher.addEventListener(PusherConnectionStatusEvent.WS_DISCONNECTED, pusher_WS_DISCONNECTED);
    _pusher.addEventListener(PusherConnectionStatusEvent.WS_FAILED, pusher_WS_FAILED);
    _pusher.addEventListener(PusherConnectionStatusEvent.WS_INTERRUPTED, pusher_WS_INTERRUPTED);

PusherConnectionStatusEvent.WS_DISCONNECTED will be dispatched if the socket disconnects, or if pingPongBasedDisconnect is enabled, the pingPongTimeout is reached.

protected function pusher_WS_DISCONNECTED(event:PusherConnectionStatusEvent):void
    logger.error("Disconnected! " + JSON.stringify(;

PusherConnectionStatusEvent.WS_FAILED will be dispatched if the socket failes for some reason. (IOError, SecurityError)

protected function pusher_WS_FAILED(event:PusherConnectionStatusEvent):void
    logger.error("Connection Failed! " + JSON.stringify(;

PusherConnectionStatusEvent.WS_INTERRUPTED will be dispatched if the socket detected a interrupt change based on ping pong timeouts. Define this timeout with interruptTimeout. is true if the connections is interrupted and false if the interruption is over.

protected function pusher_WS_INTERRUPTED(event:PusherConnectionStatusEvent):void
    logger.warn("Connection interrupted: " +;

PusherEvent.CONNECTION_ESTABLISHED will be dispatched if the pusher connection is sucessfully established.

protected function pusher_CONNECTION_ESTABLISHED(event:PusherEvent):void
    // Subscribe to a test channel and add a event listener to it.
    var testChannel:PusherChannel = _pusher.subscribe('test_channel');
    testChannel.addEventListener('MY_EVENT', testChannel_MY_EVENT);

Channels are able to dispatch custom events, based on PusherEvent.

protected function testChannel_MY_EVENT(event:PusherEvent):void
    trace('Event arrived on test_channel: ' + event.toJSON());

For a detailed example please checkout:


Copyright (c) 2014 Tilman Griesel -


[OUTDATED!] Pusher AS3 (ActionScript3) Client Library [Listed at]




No packages published
You can’t perform that action at this time.