Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added small WebSocket frame building example
  • Loading branch information
kraih committed Feb 28, 2012
1 parent 51d422f commit f98b9c3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -116,7 +116,7 @@ sub recurring {
my ($self, $after, $cb) = @_;
$self = $self->singleton unless ref $self;
weaken $self;
return $self->iowatcher->recurring($after => sub { $self->$cb(pop) });
return $self->iowatcher->recurring($after => sub { $self->$cb });
}

# "Fat Tony is a cancer on this fair city!
Expand Down Expand Up @@ -209,7 +209,7 @@ sub timer {
my ($self, $after, $cb) = @_;
$self = $self->singleton unless ref $self;
weaken $self;
return $self->iowatcher->timer($after => sub { $self->$cb(pop) });
return $self->iowatcher->timer($after => sub { $self->$cb });
}

sub _cleaner {
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/IOWatcher.pm
Expand Up @@ -113,7 +113,7 @@ sub _one_tick {
elsif ($after && $t->{recurring}) { $t->{recurring} += $after }

# Handle timer
if (my $cb = $t->{cb}) { $self->_sandbox("Timer $id", $cb, $id) }
if (my $cb = $t->{cb}) { $self->_sandbox("Timer $id", $cb) }
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/IOWatcher/EV.pm
Expand Up @@ -63,7 +63,7 @@ sub _timer {
$recurring ? $after : 0,
sub {
my $w = shift;
$self->_sandbox("Timer $id", $self->{timers}->{$id}->{cb}, $id);
$self->_sandbox("Timer $id", $self->{timers}->{$id}->{cb});
delete $self->{timers}->{$id} unless $recurring;
}
);
Expand Down
3 changes: 3 additions & 0 deletions lib/Mojo/Transaction/WebSocket.pm
Expand Up @@ -447,6 +447,9 @@ L<Mojo::Transaction> and implements the following new ones.
Build WebSocket frame.
# Build single "Binary" frame
say $ws->build_frame(1, 0, 0, 0, 2, 'Hello World!');
=head2 C<client_challenge>
my $success = $ws->client_challenge;
Expand Down

0 comments on commit f98b9c3

Please sign in to comment.