mojo2405 has asked for the wisdom of the Perl Monks concerning the following question:
Hi there, I would like to create a client in perl that can connect to node js socket.io server. I tried this code
use strict; use AnyEvent; use AnyEvent::PocketIO::Client; use PocketIO::Client::IO; #use PocketIO::Client::IO; my $socket = PocketIO::Client::IO->connect("http://127.0.0.1:3001"); my $cv = AnyEvent->condvar; my $w = AnyEvent->timer( after => 5, cb => $cv ); $socket->on( 'message', sub { say $_[1]; } ); $socket->on( 'connect', sub { #$socket->send('Parumon!'); $socket->emit( 'message', { name => 'name', message => 'msg emit' +} ); print "connected"; } ); $cv->wait;
but got this error :
28 {"code":0,"message":"Transport unknown"} 0 at /usr/local/share/perl5/AnyEvent/PocketIO/Client.pm line 86. Can't call method "transport" on an undefined value at socket-perl.pl +line 9.
can anyone help with that ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Node JS Socket.IO server with perl
by NetWallah (Canon) on Jan 04, 2018 at 01:59 UTC |