/** * Message types for the smartsocket protocol */ export type TMessageType = 'authRequest' | 'auth' | 'authResponse' | 'serverReady' | 'function' | 'functionResponse' | 'tagUpdate'; /** * Base message interface for all smartsocket messages */ export interface ISocketMessage { type: TMessageType; id?: string; payload: T; } /** * Authentication request payload (server -> client) */ export interface IAuthRequestPayload { serverAlias: string; } /** * Authentication data payload (client -> server) */ export interface IAuthPayload { alias: string; } /** * Authentication response payload (server -> client) */ export interface IAuthResponsePayload { success: boolean; error?: string; } /** * Function call payload */ export interface IFunctionCallPayload { funcName: string; funcData: T; } /** * Tag update payload */ export interface ITagUpdatePayload { tags: Record; } /** * Helper type for creating typed messages */ export type TAuthRequestMessage = ISocketMessage; export type TAuthMessage = ISocketMessage; export type TAuthResponseMessage = ISocketMessage; export type TFunctionMessage = ISocketMessage; export type TFunctionResponseMessage = ISocketMessage; export type TTagUpdateMessage = ISocketMessage;