UNPKG

forex-quotes

Version:

Realtime forex quote API client

49 lines (48 loc) 1.45 kB
import { Callback } from './ForgeClient'; export declare enum IncomingEvents { MESSAGE = "message", FORCE_CLOSE = "force_close", HEART = "heart", LOGIN = "login", POST_LOGIN_SUCCESS = "post_login_success", UPDATE = "update" } export declare enum OutgoingEvents { LOGIN = "login", SUBSCRIBE_TO = "subscribe_to", UNSUBSCRIBE_FROM = "unsubscribe_from", SUBSCRIBE_TO_ALL = "subscribe_to_all", UNSUBSCRIBE_FROM_ALL = "unsubscribe_from_all" } export declare enum IOEvents { DISCONNECT = "close", CONNECTION = "open" } export declare class SocketClient { private apiKey; private socket; private onConnectionCallback?; private onMessageCallback?; private onUpdateCallback?; private onDisconnectCallback?; constructor(apiKey: string); onMessage(onMessage: Callback): this; onUpdate(onUpdate: Callback): this; onConnect(onConnect: Callback): this; onDisconnect(onDisconnect: Callback): this; subscribeTo(symbols: string[] | string): this; subscribeToAll(): this; unsubscribeFrom(symbols: string[] | string): this; unsubscribeFromAll(): this; disconnect(): this; connect(): void; private initializeSocketClient; private handleLoginRequest; private handleOpen; private handlePostLoginSuccess; private handleMessage; private handleUpdate; private handleHeart; private handleDisconnect; private emit; }