Skip to content

Commit

Permalink
changed semantics of text event
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 11, 2013
1 parent a799a9a commit 4b0e127
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/Mojo/Transaction/WebSocket.pm
Expand Up @@ -280,8 +280,8 @@ sub _message {
# Message
my $msg = delete $self->{message};
if (delete $self->{op} == TEXT) {
$msg = decode 'UTF-8', $msg if $msg;
$self->emit(text => $msg);
$msg = decode 'UTF-8', $msg if $msg;
}
else { $self->emit(binary => $msg); }
$self->emit(message => $msg);
Expand Down Expand Up @@ -385,15 +385,15 @@ Emitted when a complete WebSocket message has been received.
=head2 text
$ws->on(text => sub {
my ($ws, $chars) = @_;
my ($ws, $bytes) = @_;
...
});
Emitted when a complete WebSocket text message has been received.
$ws->on(text => sub {
my ($ws, $chars) = @_;
say "Text: $chars";
my ($ws, $bytes) = @_;
say "Text: $bytes";
});
=head1 ATTRIBUTES
Expand Down
4 changes: 2 additions & 2 deletions t/mojolicious/websocket_lite_app.t
Expand Up @@ -17,8 +17,8 @@ websocket '/echo' => sub {
$self->on(binary => sub { shift->send({binary => shift}) });
$self->on(
text => sub {
my ($self, $chars) = @_;
$self->send("echo: $chars");
my ($self, $bytes) = @_;
$self->send("echo: $bytes");
}
);
};
Expand Down

0 comments on commit 4b0e127

Please sign in to comment.