UNPKG

metaapi.cloud-sdk

Version:

SDK for MetaApi, a professional cloud forex API which includes MetaTrader REST API and MetaTrader websocket API. Supports both MetaTrader 5 (MT5) and MetaTrader 4 (MT4). CopyFactory copy trading API included. (https://metaapi.cloud)

36 lines (35 loc) 1.47 kB
/// <reference types="socket.io-client" /> import SocketIO from 'socket.io'; import { EmitHistoryPacket } from './common.types'; import Queue from '../../tools/queue'; /** * Returns socket sticky session ID * @param socket native socket.io socket * @returns sticky session ID */ export declare function getSocketStickySessionId(socket: SocketIO.Socket): string; /** * Returns whether a socket supports sticky socket protocol * @param socket native socket.io socket * @returns whether supports the protocol */ export declare function supportsStickySocketProtocol(socket: SocketIO.Socket): boolean; /** * Returns client socket.io socket transport * @param socket native socket.io socket * @returns current transport name */ export declare function getClientSocketIoTransportName(socket: SocketIOClient.Socket): string; /** * Destroys underlying socket of a client socket, using socket.io internals. The socket must have `websocket` transport * @param socket native socket.io socket * @param err optional error */ export declare function destroyInternalClientSocket(socket: SocketIOClient.Socket, err?: Error): void; /** * Sends history events to a socket * @param socket socket to send to * @param history history to send from (will be modified) * @param startIndex start packet index to stream from */ export declare function sendHistory(socket: SocketIOClient.Socket | SocketIO.Socket, history: Queue<EmitHistoryPacket>, startIndex: number): void;