Hi Guys,
I tried the
http://mojolicio.us/perldoc/Mojolicious/Lite#WebSockets example echo server. That worked fine, but when I try to do the echo from Mojo::UserAgent using the example here:
http://mojolicio.us/perldoc/Mojo/UserAgent#websocket it doesn't work. Looking at tcpdump it doesn't even look like it tries to establish a connection (there is nothing).
All I get is "Premature connection close" (pretty much instantly).
websockets.org has a test echo thing here:
http://www.websocket.org/echo.htmlBut trying to connect to it with ua doesn't work for me. I get the same thing. I've tried it on multiple environments and different versions of perl. Mojolicious is at 4.14. So can people run the below code and have it work?
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
$ua->websocket('ws://
echo.websocket.org' =>
sub {
my ($ua, $tx) = @_;
if ( $tx->is_websocket){
print "win\n";
}else {
print "lose: ".$tx->error."\n";
}
return;
});
Thanks in advance.
LL