Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: perl client for Socket.io

by argosback (Initiate)
on Nov 27, 2013 at 17:57 UTC ( #1064675=note: print w/replies, xml ) Need Help??


in reply to perl client for Socket.io

Hi, I make a client with the info that I found, but when I send a emit I get this from socket.io:
debug - client authorized info - handshake authorized qs3kbEVnsoRBhD9hq91S debug - destroying non-socket.io upgrade
My code is:
#!/usr/bin/perl -w use PocketIO::Client::IO; my $socket = PocketIO::Client::IO->connect("http://localhost:1506"); 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;

Replies are listed 'Best First'.
Re^2: perl client for Socket.io
by mojo2405 (Acolyte) on Jan 03, 2018 at 10:12 UTC
    Hi , I tried the code above .The problem I get after trying to connect to my node js socket.io server is this : 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.

      As your $socket object is undefined, it means the connect did not work all right.

      You may debug it by inspecting the port or at least check if PocketIO::Client::IO->connect succeeded (i.e. returned an object).

      Cheers, Sören

      Créateur des bugs mobiles - let loose once, run everywhere.
      (hooked on the Perl Programming language)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1064675]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2018-02-25 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (314 votes). Check out past polls.

    Notices?