in reply to Re^2: PSGI, Plack, Twiggy, AnyEvent and SockJS... I need help
in thread PSGI, Plack, Twiggy, AnyEvent and SockJS... I need help
Please don't modify your original code that much, as people then can't learn from seeing your code progress through the stages.
The next step would be to add (much) more amounts of server-side logging. print or warn at every step of the process. At least add logging statements to the following points:
mount '/echo' => SockJS->new( handler => sub { warn "Creating new session"; my ($session) = @_; $session->on( 'data' => sub { my $session = shift; warn "got new data"; $session->write('got your message'); warn "Wrote response"; } ); $session->write('connected'); warn "Wrote greeting"; my $w_cond = AnyEvent->condvar; my $w; $w = AnyEvent->timer( after => 0, interval => 5, cb => sub { undef $w; # cleanup $session->write('5 seconds have passed'); warn "Wrote timer message"; $w_cond->send(); } ); $w_cond->recv; warn "Leaving"; }; );
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: PSGI, Plack, Twiggy, AnyEvent and SockJS... I need help
by xtpu2 (Acolyte) on Apr 09, 2014 at 15:29 UTC | |
by Corion (Patriarch) on Apr 09, 2014 at 15:40 UTC |
In Section
Seekers of Perl Wisdom