NAME

PAGI::App::WebSocket::Broadcast - Pub/sub WebSocket broadcast

SYNOPSIS

use PAGI::App::WebSocket::Broadcast;

my $app = PAGI::App::WebSocket::Broadcast->new->to_app;

DESCRIPTION

WebSocket broadcast/pub-sub server. Messages from any client are broadcast to all other connected clients in the same channel.

OPTIONS

  • channel - Default channel name (default: 'default')

  • echo_self - Whether to echo messages back to sender (default: 0)

CLASS METHODS

broadcast($channel, $message, %opts)

Broadcast a message to all clients in a channel from server-side code.

client_count($channel)

Get number of connected clients, optionally filtered by channel.