Skip to content

Commit

Permalink
documentation tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 23, 2013
1 parent 6163118 commit 7718f7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -542,7 +542,7 @@ Mojo::UserAgent - Non-blocking I/O HTTP and WebSocket user agent
$delay->wait unless Mojo::IOLoop->is_running;
# Non-blocking WebSocket connection sending and receiving JSON messages
$ua->websocket('ws://localhost:3000/echo.json' => sub {
$ua->websocket('ws://example.com/echo.json' => sub {
my ($ua, $tx) = @_;
say 'WebSocket handshake failed!' and return unless $tx->is_websocket;
$tx->on(json => sub {
Expand Down Expand Up @@ -798,8 +798,9 @@ L<Mojo::UserAgent::Transactor/"tx">.
=head2 build_websocket_tx
my $tx = $ua->build_websocket_tx('ws://localhost:3000');
my $tx = $ua->build_websocket_tx('ws://localhost:3000' => {DNT => 1});
my $tx = $ua->build_websocket_tx('ws://example.com');
my $tx =
$ua->build_websocket_tx('ws://example.com' => {DNT => 1} => ['v1.proto']);
Generate L<Mojo::Transaction::HTTP> object with
L<Mojo::UserAgent::Transactor/"websocket">.
Expand Down Expand Up @@ -970,16 +971,16 @@ non-blocking.
=head2 websocket
$ua->websocket('ws://localhost:3000' => sub {...});
$ua->websocket('ws://example.com' => sub {...});
$ua->websocket(
'ws://localhost:3000' => {DNT => 1} => ['v1.proto'] => sub {...});
'ws://example.com' => {DNT => 1} => ['v1.proto'] => sub {...});
Open a non-blocking WebSocket connection with transparent handshake, takes the
same arguments as L<Mojo::UserAgent::Transactor/"websocket">. The callback
will receive either a L<Mojo::Transaction::WebSocket> or
L<Mojo::Transaction::HTTP> object.
$ua->websocket('ws://localhost:3000/echo' => sub {
$ua->websocket('ws://example.com/echo' => sub {
my ($ua, $tx) = @_;
say 'WebSocket handshake failed!' and return unless $tx->is_websocket;
$tx->on(finish => sub {
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/UserAgent/Transactor.pm
Expand Up @@ -412,8 +412,8 @@ handshake if possible.
=head2 websocket
my $tx = $t->websocket('ws://localhost:3000');
my $tx = $t->websocket('ws://localhost:3000' => {DNT => 1} => ['v1.proto']);
my $tx = $t->websocket('ws://example.com');
my $tx = $t->websocket('ws://example.com' => {DNT => 1} => ['v1.proto']);
Versatile L<Mojo::Transaction::HTTP> transaction builder for WebSocket
handshake requests.
Expand Down

0 comments on commit 7718f7b

Please sign in to comment.