Amon2
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
- fixed testing issue
(karupanerura)
- added micro-location.js
3.52 2012-08-09
- upgrade jQuery 1.7.2 to 1.8.0
3.51 2012-08-08
- streaming support
3.50 2012-08-06
- websocket support
3.39 2012-08-05
- Bundled es5shim.js, sprintf.js, strftime.js, micro_template.js
3.38 2012-08-01
t/300_setup/08_installable.t
t/300_setup/09_minil_migrate.t
t/600_plugins/005_fillin_form_lite.t
t/600_plugins/007_json.t
t/600_plugins/007_json_default_encoding.t
t/600_plugins/007_json_hijacking.t
t/600_plugins/007_json_keysort.t
t/600_plugins/007_json_x_api_status.t
t/600_plugins/008_no_cache.t
t/600_plugins/010_plack_session.t
t/600_plugins/012_streaming.t
t/600_plugins/013_websocket.t
t/600_plugins/014_streaming_header_splitting.t
t/800_dispatcher/002_router_simple.t
t/800_dispatcher/003_lite.t
t/800_dispatcher/004_router_boom.t
t/800_dispatcher/004_router_boom_sinatraish.t
t/TestFlavor.pm
t/Util.pm
t/tmpl/foo.mt
xt/02_perlcritic.t
xt/06_dependencies.t
xt/skelton/01_basic.t
eg/LongPoll/chat.psgi view on Meta::CPAN
}
);
return $c->render_json({ok => 1});
};
any '/poll' => sub {
my ($c) = @_;
my $client_id = $c->req->param('client_id')
or die;
return $c->streaming_json(sub {
my $writer = shift;
$mq->poll_once($client_id, sub {
$writer->write_json(\@_);
$writer->close;
});
});
};
# load plugins
lib/Amon2/Plugin/Web/Streaming.pm view on Meta::CPAN
use strict;
use warnings;
use utf8;
use Amon2::Util;
use Amon2::Web::Response::Callback;
sub init {
my ($class, $c, $conf) = @_;
Amon2::Util::add_method(ref $c || $c, 'streaming', \&_streaming);
Amon2::Util::add_method(ref $c || $c, 'streaming_json', \&_streaming_json);
}
sub _streaming {
my ($self, $code) = @_;
return Amon2::Web::Response::Callback->new(
code => sub {
$code->(@_);
}
);
}
sub _streaming_json {
my ($self, $code) = @_;
return Amon2::Web::Response::Callback->new(
code => sub {
my $respond = shift;
my $writer = $respond->([200, ['Content-Type' => 'application/json;charset=utf-8']]);
my $longpoll_ctx = Amon2::Plugin::Web::Streaming::Writer->new(
$self,
$writer
t/600_plugins/012_streaming.t view on Meta::CPAN
$Plack::Test::Impl = "Server";
use Amon2;
{
package MyApp::Web;
use parent -norequire, qw/MyApp/;
use parent qw/Amon2::Web/;
sub dispatch {
my $c = shift;
$c->streaming(sub {
my ($respond) = @_;
my $writer = $respond->(
[200, ['Content-Type', 'text/html']]);
$writer->write("<html>\n");
for my $i (1..5) {
$writer->write("<div>$i</div>\n");
}
$writer->write("</html>\n");
$writer->close;
});
t/600_plugins/014_streaming_header_splitting.t view on Meta::CPAN
$Plack::Test::Impl = "Server";
use Amon2;
{
package MyApp::Web;
use parent -norequire, qw/MyApp/;
use parent qw/Amon2::Web/;
sub dispatch {
my $c = shift;
$c->streaming(sub {
my ($respond) = @_;
my $writer = $respond->(
[200, ['Content-Type', "text/html\015\012hogehoge"]]);
$writer->write("<html>\n");
for my $i (1..5) {
$writer->write("<div>$i</div>\n");
}
$writer->write("</html>\n");
$writer->close;
});
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.865 second using v1.00-cache-2.02-grep-82fe00e-cpan-9e6bc14194b )