/** * Message types for the smartsocket protocol */ export type TMessageType = | 'authRequest' // Server requests authentication from client | 'auth' // Client provides authentication data | 'authResponse' // Server responds to authentication | 'serverReady' // Server signals it's fully ready | 'function' // Function call request | 'functionResponse' // Function call response | 'tagUpdate'; // Tag store synchronization /** * Base message interface for all smartsocket messages */ export interface ISocketMessage { type: TMessageType; id?: string; // For request/response correlation 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: any; } /** * Tag update payload */ export interface ITagUpdatePayload { tags: { [key: string]: any }; } /** * 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;