Skip to content

Commit

Permalink
added JSON example for WebSockets
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 10, 2012
1 parent cf958bb commit e993e97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Changes
@@ -1,6 +1,6 @@
This file documents the revision history for Perl extension Mojolicious.

2.44 2012-01-09 00:00:00
2.44 2012-01-10 00:00:00
- Improved documentation.
- Fixed Mojo::ByteStream, Mojo::Collection and Mojo::DOM to not be
subclasses of Mojo::Base.
Expand Down
5 changes: 5 additions & 0 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -925,13 +925,18 @@ defaults to rendering an empty C<204> response.
=head2 C<send_message>
$c = $c->send_message([binary => $bytes]);
$c = $c->send_message([text => $bytes]);
$c = $c->send_message('Hi there!');
$c = $c->send_message('Hi there!', sub {...});
Send a message 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_message([text => Mojo::JSON->new->encode({hello => 'world'})]);
=head2 C<session>
my $session = $c->session;
Expand Down

0 comments on commit e993e97

Please sign in to comment.