Skip to content

Commit

Permalink
mention how WebSocket connections are established
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 14, 2013
1 parent 2ad071e commit 4707b50
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

4.15 2013-06-13
4.15 2013-06-14
- Fixed a few error reporting bugs in Mojo::IOLoop::Client and
Mojo::IOLoop::Server.

Expand Down
6 changes: 4 additions & 2 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -554,7 +554,8 @@ Data storage persistent only for the next request, stored in the C<session>.
my $cb = $c->on(finish => sub {...});
Subscribe to events of C<tx>, which is usually a L<Mojo::Transaction::HTTP> or
L<Mojo::Transaction::WebSocket> object.
L<Mojo::Transaction::WebSocket> object. Note that this method will
automatically respond to WebSocket handshakes with a C<101> response status.
# Do something after the transaction has been finished
$c->on(finish => sub {
Expand Down Expand Up @@ -772,7 +773,8 @@ is set to the value C<XMLHttpRequest>.
$c = $c->send($chars => sub {...});
Send message or frame non-blocking via WebSocket, the optional drain callback
will be invoked once all data has been written.
will be invoked once all data has been written. Note that this method will
automatically respond to WebSocket handshakes with a C<101> response status.
# Send "Text" message
$c->send('I ♥ Mojolicious!');
Expand Down
5 changes: 5 additions & 0 deletions lib/Mojolicious/Guides/Routing.pod
Expand Up @@ -528,6 +528,11 @@ additional information.

1;

The connection gets established when you respond to the WebSocket handshake
with a C<101> response status, which happens automatically if you subscribe to
an event with L<Mojolicious::Controller/"on"> or send a message with
L<Mojolicious::Controller/"send"> right away.

=head2 Bridges

Bridge routes can be used to share code with multiple nested routes, because
Expand Down

0 comments on commit 4707b50

Please sign in to comment.