@magnusbag/livets-core
Version:
TypeScript API layer for LiveTS framework
47 lines • 1.51 kB
TypeScript
/**
* LiveTS Server - HTTP and WebSocket server for LiveTS applications
*/
import { LiveView } from './live-view';
import type { ServerOptions, ComponentProps, RenderOptions } from './types';
export declare class LiveTSServer {
private components;
private activeComponents;
private componentHtmlCache;
private rustEngine?;
private rustBroker?;
private brokerConnComponents;
private port;
private host;
private app;
constructor(options: ServerOptions);
/**
* Registers a LiveView component with a simple path-based route
*/
registerComponent<T extends LiveView>(path: string, ComponentClass: new (props?: ComponentProps) => T, options?: RenderOptions): void;
private registerSimpleComponent;
close(): Promise<void>;
/**
* Gets server statistics
*/
getStats(): {
activeComponents: number;
registeredRoutes: number;
wsConnections: number;
};
private findComponentIdByShortId;
private setupMiddleware;
private setupWebSocketServer;
private handleBrokerEvent;
private handleCompactEvent;
private handleEventMessageDirect;
private handleBrokerMessage;
private handleClientEventFromBroker;
private processEventAndGenerateMessage;
private processEventAndDiff;
private generateConnectorScript;
private wrapInLayout;
private getBrokerWsUrl;
private getFallbackConnectorScript;
private extractPropsFromContext;
}
//# sourceMappingURL=server.d.ts.map