Skip to content

Commit

Permalink
update Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 10, 2016
1 parent 9fd0137 commit f7a76a9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
6 changes: 6 additions & 0 deletions Changes
@@ -1,9 +1,15 @@

6.40 2016-01-10
- Removed client_challenge, client_handshake and server_handshake methods from
Mojo::Transaction::WebSocket. (batman)
- Removed upgrade event from Mojo::Transaction::HTTP.
- Deprecated Mojo::Transaction::WebSocket::build_frame and
Mojo::Transaction::WebSocket::parse_frame in favor of
Mojo::WebSocket::build_frame and Mojo::WebSocket::parse_frame. (batman)
- Replaced deprecated proxy method in Mojo::Message::Request with an
attribute.
- Added SNI support to all built-in web servers. (bpmedley, sri)
- Added module Mojo::WebSocket. (batman)
- Added next attribute to Mojo::Transaction::HTTP.
- Updated jQuery to version 2.2.0.
- Improve mtime attribute in Mojo::Asset::Memory to default to the value of
Expand Down
4 changes: 4 additions & 0 deletions lib/Mojo/Transaction/WebSocket.pm
Expand Up @@ -25,6 +25,7 @@ has [qw(compressed masked)];
has handshake => sub { Mojo::Transaction::HTTP->new };
has max_websocket_size => sub { $ENV{MOJO_MAX_WEBSOCKET_SIZE} || 262144 };

# DEPRECATED in Clinking Beer Mugs!
sub build_frame {
deprecated 'Mojo::Transaction::WebSocket::build_frame is DEPRECATED';
Mojo::WebSocket::build_frame(shift->masked, @_);
Expand Down Expand Up @@ -88,6 +89,7 @@ sub new {
return $self;
}

# DEPRECATED in Clinking Beer Mugs!
sub parse_frame {
deprecated 'Mojo::Transaction::WebSocket::parse_frame is DEPRECATED';
Mojo::WebSocket::parse_frame($_[1], $_[0]->max_websocket_size);
Expand All @@ -104,11 +106,13 @@ sub resume { $_[0]->handshake->resume and return $_[0] }

sub send {
my ($self, $msg, $cb) = @_;

$self->once(drain => $cb) if $cb;
if (ref $msg eq 'ARRAY') {
$self->{write} .= Mojo::WebSocket::build_frame($self->masked, @$msg);
}
else { $self->{write} .= $self->build_message($msg) }

return $self->SUPER::resume;
}

Expand Down
27 changes: 13 additions & 14 deletions lib/Mojo/WebSocket.pm
@@ -1,7 +1,6 @@
package Mojo::WebSocket;
use Mojo::Base -strict;

use Compress::Raw::Zlib 'Z_SYNC_FLUSH';
use Config;
use Exporter 'import';
use Mojo::Util qw(b64_encode sha1_bytes xor_encode);
Expand Down Expand Up @@ -160,7 +159,7 @@ sub _challenge { b64_encode(sha1_bytes(($_[0] || '') . GUID), '') }
=head1 NAME
Mojo::WebSocket - WebSocket utility functions
Mojo::WebSocket - The WebSocket Protocol
=head1 SYNOPSIS
Expand All @@ -171,14 +170,17 @@ Mojo::WebSocket - WebSocket utility functions
=head1 DESCRIPTION
L<Mojo::WebSocket> provides utility functions for dealing with data over
a WebSocket.
L<Mojo::WebSocket> implements the WebSocket protocol as described in
L<RFC 6455|http://tools.ietf.org/html/rfc6455>.
=head1 FUNCTIONS
L<Mojo::WebSocket> implements the following functions, which can be imported
individually.
=head2 build_frame
my $bytes = build_frame($masked, $fin, $rsv1, $rsv2, $rsv3, $op, $payload);
my $bytes = build_frame $masked, $fin, $rsv1, $rsv2, $rsv3, $op, $payload;
Build WebSocket frame.
Expand All @@ -202,17 +204,15 @@ Build WebSocket frame.
=head2 challenge
my $bool = challenge(Mojo::Transaction::WebSocket->new);
my $bool = challenge Mojo::Transaction::WebSocket->new;
Check WebSocket handshake challenge client-side, used to implement user agents
such as L<Mojo::UserAgent>.
Check WebSocket handshake challenge.
=head2 client_handshake
my $tx = client_handshake(Mojo::Transaction::WebSocket->new);
my $tx = client_handshake Mojo::Transaction::HTTP->new;
Perform WebSocket handshake client-side, used to implement user agents such as
L<Mojo::UserAgent>.
Perform WebSocket handshake client-side.
=head2 parse_frame
Expand All @@ -231,10 +231,9 @@ Parse WebSocket frame.
=head2 server_handshake
my $tx = server_handshake(Mojo::Transaction::WebSocket->new);
my $tx = server_handshake Mojo::Transaction::HTTP->new;
Perform WebSocket handshake server-side, used to implement web servers such as
L<Mojo::Server::Daemon>.
Perform WebSocket handshake server-side.
=head1 SEE ALSO
Expand Down
4 changes: 2 additions & 2 deletions t/pod_coverage.t
Expand Up @@ -12,6 +12,6 @@ my %RULES = (
'Mojo::Transaction::WebSocket' =>
{also_private => [qw(build_frame parse_frame)]},
);

pod_coverage_ok($_, $RULES{$_} || {}) for all_modules();
done_testing;

done_testing();

0 comments on commit f7a76a9

Please sign in to comment.