Skip to content

Commit

Permalink
better frame examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 11, 2013
1 parent 375b9f0 commit 506c99a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/Mojo/Transaction/WebSocket.pm
Expand Up @@ -292,7 +292,7 @@ sub _message {
my $msg = delete $self->{message};
if (delete $self->{op} == TEXT) {
$self->emit(text => $msg);
$msg = decode 'UTF-8', $msg if $msg;
$msg = decode 'UTF-8', $msg;
}
else { $self->emit(binary => $msg); }
$self->emit(message => $msg);
Expand Down Expand Up @@ -464,15 +464,15 @@ C<CLOSE> frames automatically.
Build WebSocket frame.
# Continuation frame with FIN bit and payload
say $ws->build_frame(1, 0, 0, 0, 0, 'World!');
# Text frame with payload
say $ws->build_frame(0, 0, 0, 0, 1, 'Hello');
# Binary frame with FIN bit and payload
say $ws->build_frame(1, 0, 0, 0, 2, 'Hello World!');
# Text frame with payload but without FIN bit
say $ws->build_frame(0, 0, 0, 0, 1, 'Hello ');
# Continuation frame with FIN bit and payload
say $ws->build_frame(1, 0, 0, 0, 0, 'World!');
# Close frame with FIN bit and without payload
say $ws->build_frame(1, 0, 0, 0, 8, '');
Expand Down

0 comments on commit 506c99a

Please sign in to comment.