You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

connection.d.ts 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /// <reference types="node" />
  2. import { EventEmitter } from 'events';
  3. import { BaseRequest } from '../models/methods/baseMethod';
  4. interface ConnectionOptions {
  5. trace?: boolean | ((id: string, message: string) => void);
  6. proxy?: string;
  7. proxyAuthorization?: string;
  8. authorization?: string;
  9. trustedCertificates?: string[];
  10. key?: string;
  11. passphrase?: string;
  12. certificate?: string;
  13. timeout: number;
  14. connectionTimeout: number;
  15. headers?: {
  16. [key: string]: string;
  17. };
  18. }
  19. export type ConnectionUserOptions = Partial<ConnectionOptions>;
  20. export declare const INTENTIONAL_DISCONNECT_CODE = 4000;
  21. export declare class Connection extends EventEmitter {
  22. private readonly url;
  23. private ws;
  24. private reconnectTimeoutID;
  25. private heartbeatIntervalID;
  26. private readonly retryConnectionBackoff;
  27. private readonly config;
  28. private readonly requestManager;
  29. private readonly connectionManager;
  30. constructor(url?: string, options?: ConnectionUserOptions);
  31. private get state();
  32. private get shouldBeConnected();
  33. isConnected(): boolean;
  34. connect(): Promise<void>;
  35. disconnect(): Promise<number | undefined>;
  36. reconnect(): Promise<void>;
  37. request<T extends BaseRequest>(request: T, timeout?: number): Promise<unknown>;
  38. getUrl(): string;
  39. readonly trace: (id: string, message: string) => void;
  40. private onMessage;
  41. private onceOpen;
  42. private intentionalDisconnect;
  43. private clearHeartbeatInterval;
  44. private startHeartbeatInterval;
  45. private heartbeat;
  46. private onConnectionFailed;
  47. }
  48. export {};
  49. //# sourceMappingURL=connection.d.ts.map