Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added example for WebSocket message timing
  • Loading branch information
kraih committed Jun 6, 2013
1 parent 489f0a6 commit e2d5912
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -795,6 +795,12 @@ will be invoked once all data has been written.
# Send "Ping" frame
$c->send([1, 0, 0, 0, 9, 'Hello World!']);
# Make sure previous message has been written before continuing
$c->send('First message!' => sub {
my $c = shift;
$c->send('Second message!');
});
For mostly idle WebSockets you might also want to increase the inactivity
timeout, which usually defaults to C<15> seconds.
Expand Down

0 comments on commit e2d5912

Please sign in to comment.