uniapp,h5

polling.d.ts 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { Transport } from "../transport.js";
  2. export declare abstract class Polling extends Transport {
  3. private _polling;
  4. get name(): string;
  5. /**
  6. * Opens the socket (triggers polling). We write a PING message to determine
  7. * when the transport is open.
  8. *
  9. * @protected
  10. */
  11. doOpen(): void;
  12. /**
  13. * Pauses polling.
  14. *
  15. * @param {Function} onPause - callback upon buffers are flushed and transport is paused
  16. * @package
  17. */
  18. pause(onPause: any): void;
  19. /**
  20. * Starts polling cycle.
  21. *
  22. * @private
  23. */
  24. private _poll;
  25. /**
  26. * Overloads onData to detect payloads.
  27. *
  28. * @protected
  29. */
  30. onData(data: any): void;
  31. /**
  32. * For polling, send a close packet.
  33. *
  34. * @protected
  35. */
  36. doClose(): void;
  37. /**
  38. * Writes a packets payload.
  39. *
  40. * @param {Array} packets - data packets
  41. * @protected
  42. */
  43. write(packets: any): void;
  44. /**
  45. * Generates uri for connection.
  46. *
  47. * @private
  48. */
  49. protected uri(): string;
  50. abstract doPoll(): any;
  51. abstract doWrite(data: string, callback: () => void): any;
  52. }