Skip to content

Commit

Permalink
no need for multiple WebSocket classes
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 9, 2016
1 parent 79de237 commit 9c5b79e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
4 changes: 0 additions & 4 deletions lib/Mojo/Channel/WebSocket/Client.pm

This file was deleted.

4 changes: 0 additions & 4 deletions lib/Mojo/Channel/WebSocket/Server.pm

This file was deleted.

4 changes: 2 additions & 2 deletions lib/Mojo/Server/Daemon.pm
Expand Up @@ -3,7 +3,7 @@ use Mojo::Base 'Mojo::Server';

use Carp 'croak';
use Mojo::Channel::HTTP::Server;
use Mojo::Channel::WebSocket::Server;
use Mojo::Channel::WebSocket;
use Mojo::IOLoop;
use Mojo::Transaction::WebSocket;
use Mojo::URL;
Expand Down Expand Up @@ -129,7 +129,7 @@ sub _finish {
# Successful upgrade
if ($ws->handshake($tx->next(undef))->res->code == 101) {
$c = $self->{connections}{$id}
= Mojo::Channel::WebSocket::Server->new(tls => $c->{tls}, tx => $ws);
= Mojo::Channel::WebSocket->new(tls => $c->{tls}, tx => $ws);
weaken $self;
$ws->on(resume => sub { $self->_write($id) });
$ws->server_open;
Expand Down
5 changes: 2 additions & 3 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -4,7 +4,7 @@ use Mojo::Base 'Mojo::EventEmitter';
# "Fry: Since when is the Internet about robbing people of their privacy?
# Bender: August 6, 1991."
use Mojo::Channel::HTTP::Client;
use Mojo::Channel::WebSocket::Client;
use Mojo::Channel::WebSocket;
use Mojo::IOLoop;
use Mojo::Util qw(monkey_patch term_escape);
use Mojo::UserAgent::CookieJar;
Expand Down Expand Up @@ -241,8 +241,7 @@ sub _finish {
if (my $new = $self->transactor->upgrade($old)) {
weaken $self;
$new->on(resume => sub { $self->_write($id) });
my $ws = Mojo::Channel::WebSocket::Client->new(ioloop => $c->{ioloop},
tx => $new);
my $ws = Mojo::Channel::WebSocket->new(ioloop => $c->{ioloop}, tx => $new);
$self->{connections}{$id} = $ws;
$c->{cb}($self, $c->{tx} = $new);
return $ws->read($old->res->content->leftovers);
Expand Down

0 comments on commit 9c5b79e

Please sign in to comment.