/** * WioEX Stream Protocol Message Types * * These enums define the standard message types used for communication * between the WioEX Stream SDK and the WebSocket server. * * IMPORTANT: These types must be kept in sync between: * - SDK (TypeScript) * - Server (JavaScript) */ /** * Client-to-Server Message Types * Messages that the client sends to the server */ export declare enum ClientMessageType { /** Register/authenticate with the server using a JWT token */ REGISTER = "register", /** Subscribe to real-time ticker data for specified symbols */ SUBSCRIBE = "subscribe", /** Unsubscribe from ticker data for specified symbols */ UNSUBSCRIBE = "unsubscribe", /** Subscribe to trading signals for specified symbols */ SUBSCRIBE_SIGNALS = "subscribe-signals", /** Unsubscribe from trading signals for specified symbols */ UNSUBSCRIBE_SIGNALS = "unsubscribe-signals", /** Send ping to server to check connection health */ PING = "ping", /** Request server and connection status information */ STATUS = "status" } /** * Server-to-Client Message Types * Messages that the server sends to the client */ export declare enum ServerMessageType { /** Server capability detection and negotiation */ CAPABILITY_DETECT = "capability_detect", /** Initial connection establishment confirmation */ CONNECTED = "connected", /** Registration/authentication success confirmation */ REGISTERED = "registered", /** Subscription confirmation with list of subscribed symbols */ SUBSCRIBED = "subscribed", /** Unsubscription confirmation with list of unsubscribed symbols */ UNSUBSCRIBED = "unsubscribed", /** Real-time ticker data for a symbol */ TICKER = "ticker", /** Trading signal data */ SIGNAL = "signal", /** Signal trigger notification */ SIGNAL_TRIGGERED = "signal-triggered", /** Signal subscription confirmation */ SIGNAL_SUBSCRIBED = "signal-subscribed", /** Signal unsubscription confirmation */ SIGNAL_UNSUBSCRIBED = "signal-unsubscribed", /** Response to ping request */ PONG = "pong", /** Server status response */ STATUS_RESPONSE = "status", /** Error message from server */ ERROR = "error" } /** * Combined Message Types * Union of all possible message types for validation */ export type MessageType = ClientMessageType | ServerMessageType; /** * Message Status Types * Standard status indicators for server responses */ export declare enum MessageStatus { /** Operation completed successfully */ SUCCESS = "success", /** Operation failed due to an error */ ERROR = "error", /** Operation is in progress */ PENDING = "pending" } /** * Error Types * Standard error categories for consistent error handling */ export declare enum ErrorType { /** Authentication or authorization failed */ AUTH_FAILED = "auth_failed", /** Invalid message format or structure */ MESSAGE_ERROR = "message_error", /** Unknown or unsupported message type */ UNKNOWN_MESSAGE_TYPE = "unknown_message_type", /** Subscription operation failed */ SUBSCRIPTION_FAILED = "subscription_failed", /** Unsubscription operation failed */ UNSUBSCRIPTION_FAILED = "unsubscription_failed", /** Rate limiting exceeded */ RATE_LIMITED = "rate_limited", /** Server internal error */ INTERNAL_ERROR = "internal_error", /** Invalid symbol or parameter */ INVALID_SYMBOL = "invalid_symbol", /** Maximum symbol limit exceeded */ SYMBOL_LIMIT_EXCEEDED = "symbol_limit_exceeded" } /** * Protocol Formats * Supported message encoding formats */ export declare enum ProtocolFormat { /** JSON text format */ JSON = "json", /** MessagePack binary format */ BINARY = "binary" } /** * Type Guards and Validation Functions */ /** * Check if a string is a valid client message type */ export declare function isClientMessageType(type: string): type is ClientMessageType; /** * Check if a string is a valid server message type */ export declare function isServerMessageType(type: string): type is ServerMessageType; /** * Check if a string is a valid message type (client or server) */ export declare function isValidMessageType(type: string): type is MessageType; /** * Check if a string is a valid message status */ export declare function isValidMessageStatus(status: string): status is MessageStatus; /** * Check if a string is a valid error type */ export declare function isValidErrorType(errorType: string): errorType is ErrorType; /** * Export constants for JavaScript compatibility */ export declare const MESSAGE_TYPES: { readonly CLIENT: typeof ClientMessageType; readonly SERVER: typeof ServerMessageType; readonly STATUS: typeof MessageStatus; readonly ERROR: typeof ErrorType; readonly PROTOCOL: typeof ProtocolFormat; }; /** * Default exports for backward compatibility */ export default MESSAGE_TYPES; //# sourceMappingURL=MessageTypes.d.ts.map