1

I am having issue using AnyEvent::WebSocket::Client. The send/receive system works well, but I want to use the on finish callback to handle connection closure but it is never called.

my $client = AnyEvent::WebSocket::Client->new;

$client->connect("ws://...")->cb(sub {
    our $connection = eval { shift->recv };

    if ($@) {
        warn $@;
        return;
    }

    $connection->on(each_message => sub {
        ...
    });

    $connection->on(finish => sub {
        print "Connection finished\n";
    });
});

AnyEvent->condvar->recv;

I want the client to try to reconnect when the connection is terminating, but the on finish callback is never called when I shut down my websocket server.

Any help would be great !

robinvrd
  • 1,760
  • 12
  • 28
  • What web server are you using? You may also try to ask at the GitHub [issue tracker](https://github.com/plicease/AnyEvent-WebSocket-Client/issues) – Håkon Hægland Aug 21 '20 at 12:20
  • @HåkonHægland I am using Java webserver Payaraa, I am using it for websockets on another use case with javascript websocket client and everything is working fine there. – robinvrd Sep 01 '20 at 09:12

0 Answers0