Mercury::Controller::PushPull - Push/pull message pattern controller
version 0.010
# myapp.pl use Mojolicious::Lite; plugin 'Mercury'; websocket( '/push/*topic' ) ->to( controller => 'PushPull', action => 'push' ); websocket( '/pull/*topic' ) ->to( controller => 'PushPull', action => 'pull' );
This controller enables a push/pull pattern on a pair of endpoints (push and pull.
For more information on the push/pull pattern, see Mercury::Pattern::PushPull.
$app->routes->websocket( '/push/*topic' ) ->to( controller => 'PushPull', action => 'push' );
Controller action to connect a websocket to a push endpoint. A push client sends messages through the socket. The message will be sent to one of the connected pull clients in a round-robin fashion.
This endpoint requires a topic in the stash.
topic
$app->routes->websocket( '/pull/*topic' ) ->to( controller => 'PushPull', action => 'pull' );
Controller action to connect a websocket to a pull endpoint. A pull client will recieve messages from push clients in a round-robin fashion. One message from a pusher will be received by exactly one puller.
Post a new message to the given topic without subscribing or establishing a WebSocket connection. This allows new messages to be easily pushed by any HTTP client.
Doug Bell <preaction@cpan.org>
This software is copyright (c) 2016 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
1 POD Error
The following errors were encountered while parsing the POD:
alternative text 'push/pull pattern' contains non-escaped | or /
To install Mercury, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mercury
CPAN shell
perl -MCPAN -e shell install Mercury
For more information on module installation, please visit the detailed CPAN module installation guide.