polling.d.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /// <reference types="node" />
  2. import { Transport } from "../transport";
  3. import { IncomingMessage, ServerResponse } from "http";
  4. export declare class Polling extends Transport {
  5. maxHttpBufferSize: number;
  6. httpCompression: any;
  7. private res;
  8. private dataReq;
  9. private dataRes;
  10. private shouldClose;
  11. private readonly closeTimeout;
  12. /**
  13. * HTTP polling constructor.
  14. *
  15. * @api public.
  16. */
  17. constructor(req: any);
  18. /**
  19. * Transport name
  20. *
  21. * @api public
  22. */
  23. get name(): string;
  24. get supportsFraming(): boolean;
  25. /**
  26. * Overrides onRequest.
  27. *
  28. * @param {http.IncomingMessage}
  29. * @api private
  30. */
  31. onRequest(req: IncomingMessage & {
  32. res: ServerResponse;
  33. }): void;
  34. /**
  35. * The client sends a request awaiting for us to send data.
  36. *
  37. * @api private
  38. */
  39. onPollRequest(req: any, res: any): void;
  40. /**
  41. * The client sends a request with data.
  42. *
  43. * @api private
  44. */
  45. onDataRequest(req: IncomingMessage, res: ServerResponse): void;
  46. /**
  47. * Processes the incoming data payload.
  48. *
  49. * @param {String} encoded payload
  50. * @api private
  51. */
  52. onData(data: any): void;
  53. /**
  54. * Overrides onClose.
  55. *
  56. * @api private
  57. */
  58. onClose(): void;
  59. /**
  60. * Writes a packet payload.
  61. *
  62. * @param {Object} packet
  63. * @api private
  64. */
  65. send(packets: any): void;
  66. /**
  67. * Writes data as response to poll request.
  68. *
  69. * @param {String} data
  70. * @param {Object} options
  71. * @api private
  72. */
  73. write(data: any, options: any): void;
  74. /**
  75. * Performs the write.
  76. *
  77. * @api private
  78. */
  79. doWrite(data: any, options: any, callback: any): void;
  80. /**
  81. * Compresses data.
  82. *
  83. * @api private
  84. */
  85. compress(data: any, encoding: any, callback: any): void;
  86. /**
  87. * Closes the transport.
  88. *
  89. * @api private
  90. */
  91. doClose(fn: any): void;
  92. /**
  93. * Returns headers for a response.
  94. *
  95. * @param {http.IncomingMessage} request
  96. * @param {Object} extra headers
  97. * @api private
  98. */
  99. headers(req: any, headers: any): any;
  100. }