class Obsctl::Server::ClientRegistry

Overview

Tracks IPC clients subscribed to pushed state, event, and log topics.

Defined in:

obsctl/server/client_registry.cr

Constant Summary

ALLOWED_TOPICS = Set {"state", "events", "logs"}

Constructors

Instance Method Summary

Constructor Detail

def self.new #

Creates an empty registry.


[View source]

Instance Method Detail

def add(session : IPC::ClientSession, topics : Array(String)) : Nil #

Adds or replaces a subscription for a connected client session.


[View source]
def broadcast(topic : String, data : JSON::Any | Nil = nil) : Nil #

Broadcasts a topic event to all matching subscribers.


[View source]
def client_count : Int32 #

Returns the current number of registered client sessions.


[View source]
def remove(session : IPC::ClientSession) : Nil #

Removes a client session from the registry.


[View source]