HttpConnection.d.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { IConnection } from "./IConnection";
  2. import { IHttpConnectionOptions } from "./IHttpConnectionOptions";
  3. import { HttpTransportType, TransferFormat } from "./ITransport";
  4. /** @private */
  5. export interface INegotiateResponse {
  6. connectionId?: string;
  7. availableTransports?: IAvailableTransport[];
  8. url?: string;
  9. accessToken?: string;
  10. error?: string;
  11. }
  12. /** @private */
  13. export interface IAvailableTransport {
  14. transport: keyof typeof HttpTransportType;
  15. transferFormats: Array<keyof typeof TransferFormat>;
  16. }
  17. /** @private */
  18. export declare class HttpConnection implements IConnection {
  19. private connectionState;
  20. private baseUrl;
  21. private readonly httpClient;
  22. private readonly logger;
  23. private readonly options;
  24. private transport?;
  25. private startPromise?;
  26. private stopError?;
  27. private accessTokenFactory?;
  28. readonly features: any;
  29. onreceive: ((data: string | ArrayBuffer) => void) | null;
  30. onclose: ((e?: Error) => void) | null;
  31. constructor(url: string, options?: IHttpConnectionOptions);
  32. start(): Promise<void>;
  33. start(transferFormat: TransferFormat): Promise<void>;
  34. send(data: string | ArrayBuffer): Promise<void>;
  35. stop(error?: Error): Promise<void>;
  36. private startInternal;
  37. private getNegotiationResponse;
  38. private createConnectUrl;
  39. private createTransport;
  40. private constructTransport;
  41. private resolveTransport;
  42. private isITransport;
  43. private changeState;
  44. private stopConnection;
  45. private resolveUrl;
  46. private resolveNegotiateUrl;
  47. }