Black Vagrant has asked for the wisdom of the Perl Monks concerning the following question:
Good day, how i can get all connected clients to my websocket server for send "global" message
For example:
my $server = AnyEvent::WebSocket::Server->new(); my $tcp_server = tcp_server undef, 3000, sub { my ($fh) = @_; $server->establish($fh)->cb( sub { my $connection = eval { shift->recv }; ... $connection->on( each_message => sub { my ($connection, $message) = @_; # how i can get all connections # and then send message to all clients? foreach my $connection (@all_connections) { $connection->send($message) or die $!; } } ); ... } ); };
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: AnyEvent::WebSocket::Server get all connections
by roboticus (Chancellor) on Oct 11, 2017 at 12:44 UTC | |
by Black Vagrant (Novice) on Oct 12, 2017 at 08:52 UTC |
Back to
Seekers of Perl Wisdom