Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
move client_read methods to respective channel classes
- Loading branch information
Showing
6 changed files
with
51 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package Mojo::Channel::WebSocket; | ||
|
||
use Mojo::Base -base; | ||
|
||
has [qw/ioloop tx/]; | ||
|
||
sub read { | ||
my ($self, $chunk) = @_; | ||
my $tx = $self->tx; | ||
|
||
$self->{read} .= $chunk // ''; | ||
while (my $frame = $tx->parse_frame(\$self->{read})) { | ||
$tx->finish(1009) and last unless ref $frame; | ||
$tx->emit(frame => $frame); | ||
} | ||
|
||
$tx->emit('resume'); | ||
} | ||
|
||
1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package Mojo::Channel::WebSocket::Client; | ||
|
||
use Mojo::Base 'Mojo::Channel::WebSocket'; | ||
|
||
1; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters