Jifty::Plugin::PubSub::Connection - Connection to browser
This class represents a bidirectional channel between the server and the web browser. You may wish to subclass this class as YourApp::PubSub to override the "connect", "receive", or "disconnect" methods.
YourApp::PubSub
Called when a connection is established from the browser. By default, does nothing.
Subscribes the browser to receive messages on the given topics.
Sends an arbitrary message to the browser. It is not published to the rest of the message bus.
Called when a message is received from the web browser; returns true if the message was processed, false otherwise. If you override this method, be sure you respect this class' return value:
sub receive { my $self = shift; my $msg = shift; return 1 if $self->SUPER::receive( $msg ); # ... }
Called when the connection to the browser is lost when the browser switches to a new page. This is not immediate, but occurs after a 15-second timeout.
Returns the constructed Jifty::Web object which is seen as Jifty-web> whenever in the context of this connection's "connect", "receive", "disconnect", or when page regions are rendered to be sent over this channel. This ensures that Jifty-web->current_user> is set whenever it is relevant.
Jifty-
A new Jifty::API object is instantiated for each Jifty::Plugin::PubSub::Connection object. You may wish to limit it to limit which actions can be performed by the web browser.
The AnyMQ::Queue object which listens to events for the client.
Returns a unique identifier associated with this connection.
Creates, validates, and runs an action if it was received by the client; called by "receive".
Called when one or more regions on the page needs to be rendered and pushed to the client, as triggered by an event. The rendered regions will be passed EVENT as an event variable. Currently, rendered regions cannot alter the client's subscription set.
event
To install Jifty, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Jifty
CPAN shell
perl -MCPAN -e shell install Jifty
For more information on module installation, please visit the detailed CPAN module installation guide.