Skip to content

Commit

Permalink
added a few WebSocket examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 24, 2012
1 parent 455b8fe commit fe76875
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,5 +1,8 @@
This file documents the revision history for Perl extension Mojolicious.

2.53 2012-02-24 00:00:00
- Improved documentation.

2.52 2012-02-24 00:00:00
- Removed experimental status from config method in Mojo.
- Renamed send_message method in Mojolicious::Controller to send.
Expand Down
7 changes: 5 additions & 2 deletions lib/Mojo/Transaction/WebSocket.pm
Expand Up @@ -549,8 +549,11 @@ Alias for L<Mojo::Transaction/"resume">.
$ws->send('Hi there!');
$ws->send('Hi there!' => sub {...});
Send a message or single frame non-blocking via WebSocket, the optional drain
callback will be invoked once all data has been written.
Send message or frame non-blocking via WebSocket, the optional drain callback
will be invoked once all data has been written.
# Send "Ping" frame
$ws->send([1, 0, 0, 0, 9, 'Hello World!']);
=head2 C<server_handshake>
Expand Down
9 changes: 6 additions & 3 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -920,13 +920,16 @@ defaults to rendering an empty C<204> response.
$c = $c->send('Hi there!');
$c = $c->send('Hi there!', sub {...});
Send a message or single frame non-blocking via WebSocket, the optional drain
callback will be invoked once all data has been written. Note that this
method is EXPERIMENTAL and might change without warning!
Send message or frame non-blocking via WebSocket, the optional drain callback
will be invoked once all data has been written. Note that this method is
EXPERIMENTAL and might change without warning!
# Send JSON object as text frame
$c->send({text => Mojo::JSON->new->encode({hello => 'world'})});
# Send "Ping" frame
$c->send([1, 0, 0, 0, 9, 'Hello World!']);
=head2 C<session>
my $session = $c->session;
Expand Down
4 changes: 2 additions & 2 deletions lib/Test/Mojo.pm
Expand Up @@ -687,8 +687,8 @@ Reset user agent session.
$t = $t->send_ok('hello');
$t = $t->send_ok('hello', 'sent successfully');
Send C<WebSocket> message or single frame. Note that this method is
EXPERIMENTAL and might change without warning!
Send message or frame via WebSocket. Note that this method is EXPERIMENTAL
and might change without warning!
=head2 C<status_is>
Expand Down

0 comments on commit fe76875

Please sign in to comment.