Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Pass env as a second argument to the handler

  • Loading branch information...
commit 82693b01f7d7eab6a0f67aee23be596dd30c27d4 1 parent a6195a2
@vti authored
Showing with 4 additions and 4 deletions.
  1. +2 −3 lib/PocketIO/Connection.pm
  2. +2 −1  lib/PocketIO/Resource.pm
View
5 lib/PocketIO/Connection.pm
@@ -42,10 +42,9 @@ sub new {
my $on_connect = delete $self->{on_connect} || sub { };
$self->{on_connect} = sub {
my $self = shift;
- my @args = @_;
eval {
- $on_connect->($self->{socket}, @args);
+ $on_connect->($self->{socket}, @{$self->{on_connect_args} || []});
1;
}
or do {
@@ -320,7 +319,7 @@ sub write {
$bytes = $bytes->to_bytes if blessed $bytes;
- if ($self->on('write')) {
+ if ($self->{on_write}) {
DEBUG && $self->_debug("Writing '" . substr($bytes, 0, 50) . "'");
$self->emit('write', $bytes);
}
View
3  lib/PocketIO/Resource.pm
@@ -103,7 +103,8 @@ sub _dispatch_handshake {
eval {
$self->_build_connection(
- on_connect => $cb,
+ on_connect => $cb,
+ on_connect_args => [$env],
$self->_on_connection_created($env, $respond)
);
Please sign in to comment.
Something went wrong with that request. Please try again.