Handling postback for PoCo::TCP::Server

[email protected] (Josh803316)
Newsgroups perl.poe
Message-ID <[email protected]>
I'm trying to create a postback event  for my server .......but for some
reason I'm not seeing the $session->postback('client_output') get called.  I
want to wait to receive a response from the $kernel->post before I respond
back to the client with the returned result.

I think my syntax must be wrong in the post string order but I wasn't sure
how to change it to send args and the postback correctly

$self->{server}= POE::Component::Server::TCP->new(
          ..........
          # Handle client requests here.
          ClientInput => sub {
                 my ($kernel, $heap, $session, $list) = @_[KERNEL, HEAP,
SESSION, ARG0];
                .............
                $kernel->post( $session_alias, $event, [$alias, $params],
$session->postback('client_output') );

                #$heap->{client}->put(\%response);
          },
          InlineStates => {
            client_output => sub {
              my ($heap, $response) = @_[HEAP, ARG1];
              print STDERR "MADE IT TO THE CALLBACK\n";
              $heap->{client}->put($response->[0])
                if defined $heap->{client}
                  # that is, if $heap->{client} is still connected
              }
          },

          SessionParams => [ options => { debug => 1, trace => 1 } ],

          ClientDisconnected => sub {
                my $kernel = $_[KERNEL];
                print STDERR "THE CLIENT DISCONNECTED\n";

          },

    );
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.