Permalink
Browse files

better synopsis examples for transactions

  • Loading branch information...
1 parent e6634f3 commit 6ec08a70bcc47a72012ea0cb8c2195a71d322091 @kraih committed Aug 13, 2012
Showing with 7 additions and 0 deletions.
  1. +1 −0 Changes
  2. +2 −0 lib/Mojo/Transaction/HTTP.pm
  3. +4 −0 lib/Mojo/Transaction/WebSocket.pm
View
@@ -1,6 +1,7 @@
3.30 2012-08-14
- Added te method to Mojo::Headers.
+ - Improved documentation.
- Fixed small content encoding bug in Mojo::Message.
3.29 2012-08-13
@@ -242,12 +242,14 @@ Mojo::Transaction::HTTP - HTTP transaction
say $tx->res->code;
say $tx->res->headers->content_type;
say $tx->res->body;
+ say $tx->remote_address;
# Server
my $tx = Mojo::Transaction::HTTP->new;
say $tx->req->method;
say $tx->req->url->to_abs;
say $tx->req->headers->accept;
+ say $tx->remote_address;
$tx->res->code(200);
$tx->res->headers->content_type('text/plain');
$tx->res->body('Hello World!');
@@ -314,6 +314,10 @@ Mojo::Transaction::WebSocket - WebSocket transaction
my ($ws, $message) = @_;
say "Message: $message";
});
+ $ws->on(finish => sub {
+ my $ws = shift;
+ say 'WebSocket closed.';
+ });
=head1 DESCRIPTION

0 comments on commit 6ec08a7

Please sign in to comment.