/*************************************************************************** * Sockular * * @author Nehonix * @license NOSL * * Copyright (c) 2025 Nehonix. All rights reserved. * * This License governs the use, modification, and distribution of software * provided by NEHONIX under its open source projects. * NEHONIX is committed to fostering collaborative innovation while strictly * protecting its intellectual property rights. * Violation of any term of this License will result in immediate termination of all granted rights * and may subject the violator to legal action. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, * AND NON-INFRINGEMENT. * IN NO EVENT SHALL NEHONIX BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, * OR CONSEQUENTIAL DAMAGES ARISING FROM THE USE OR INABILITY TO USE THE SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. * ***************************************************************************** */ import { Socket, SocketOptions, ManagerOptions } from 'socket.io-client'; /** * Options for SockularClient */ export interface SockularClientOptions extends Partial { /** * Whether to automatically connect to the server * @default true */ autoConnect?: boolean; } /** * SockularClient * A fluent client for interacting with Sockular servers */ export declare class SockularClient { private socket; constructor(url: string, options?: SockularClientOptions); /** * Get the underlying Socket.IO client instance */ get io(): Socket; /** * Check if the client is connected */ get connected(): boolean; /** * Connect to the server. * Allows overriding auth or other options before connecting. * @param options Optional options to merge into the socket (e.g., auth) */ connect(options?: Partial): void; /** * Disconnect from the server */ disconnect(): void; /** * Access a specific service on the server * @param serviceName The name of the service to interact with */ service(serviceName: string): { /** * Send a message to the service * @param type The message type/action * @param data The payload data */ emit: (type: string, data?: any) => void; /** * Listen for events from the service * @param event The event name to listen for * @param callback The callback function */ on: (event: string, callback: (...args: any[]) => void) => void; /** * Listen for an event once * @param event The event name * @param callback The callback function */ once: (event: string, callback: (...args: any[]) => void) => void; /** * Stop listening for events * @param event The event name * @param callback Optional specific callback to remove */ off: (event: string, callback?: (...args: any[]) => void) => void; }; /** * Listen for global socket events (connect, disconnect, error, etc.) */ on(event: string, callback: (...args: any[]) => void): void; /** * Listen for a global socket event once */ once(event: string, callback: (...args: any[]) => void): void; /** * Stop listening for global socket events */ off(event: string, callback?: (...args: any[]) => void): void; /** * Send a heartbeat to the server to keep the connection alive */ sendHeartbeat(): void; } //# sourceMappingURL=SockularClient.d.ts.map