Centrifugo-Client
view release on metacpan or search on metacpan
lib/Centrifugo/Client.pm view on Meta::CPAN
# The websocket connection is OK
$this->_on_ws_connect();
});
}
# This function is called when client is connected to the WebSocket
sub _on_ws_connect {
my ($this) = @_;
$this->_debug( "Centrifugo::Client : WebSocket connected to $this->{WS_URL}" );
# define the callbacks
$this->{WSHANDLE}->on(each_message => sub { $this->_on_ws_message($_[1]) });
$this->{WSHANDLE}->on(finish => sub { $this->_on_close(($_[0])->close_reason()) });
$this->{WSHANDLE}->on(parse_error => sub {
my($cnx, $error) = @_;
$this->_debug( "Error in Centrifugo::Client : $error" );
$this->{ON}->{'error'}->($error) if $this->{ON}->{'error'};
});
# Then, connects to Centrifugo
$this->_send_message( {
( run in 0.357 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )