NAME Dancer::Plugin::WebSocket - A Dancer plugin for easily creating WebSocket apps VERSION version 0.0001 SYNOPSIS # ./bin/app.pl use Dancer; use Dancer::Plugin::WebSocket; get '/' => sub { template 'index' }; any '/send_msg' => sub { my $msg = params->{msg}; websocket_send($msg); return "sent $msg\n"; }; dance; # ./views/index.tt Connection Status: Disconnected # Run app with Twiggy plackup -s Twiggy bin/app.pl # Visit http://localhost:5000 and click the button or interact via curl: curl http://localhost:5000/send_msg?msg=hello DESCRIPTION This plugin provides the keyword websocket_send, which takes 1 argument, the message to send to the websocket. This plugin is built on top of Web::Hippie, but it abstracts that out for you. You should be aware that it registers 2 routes that Web::Hippie needs: get('/new_listener') and get('/message'). Be careful to not define those routes in your app. This requires that you have Plack and Web::Hippie installed. It also requires that you run your app via Twiggy. I'm not sure why. For example: plackup -s Twiggy bin/app.pl AUTHORS * Naveed Massjouni * Franck Cuny COPYRIGHT AND LICENSE This software is copyright (c) 2010 by Naveed Massjouni. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.