Node-Red configuration
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

socket.d.ts 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /// <reference types="node" />
  2. import { EventEmitter } from "events";
  3. import { IncomingMessage } from "http";
  4. import { Transport } from "./transport";
  5. export declare class Socket extends EventEmitter {
  6. readonly protocol: number;
  7. readonly request: IncomingMessage;
  8. readonly remoteAddress: string;
  9. _readyState: string;
  10. transport: Transport;
  11. private server;
  12. private upgrading;
  13. private upgraded;
  14. private writeBuffer;
  15. private packetsFn;
  16. private sentCallbackFn;
  17. private cleanupFn;
  18. private checkIntervalTimer;
  19. private upgradeTimeoutTimer;
  20. private pingTimeoutTimer;
  21. private pingIntervalTimer;
  22. private readonly id;
  23. get readyState(): string;
  24. set readyState(state: string);
  25. /**
  26. * Client class (abstract).
  27. *
  28. * @api private
  29. */
  30. constructor(id: any, server: any, transport: any, req: any, protocol: any);
  31. /**
  32. * Called upon transport considered open.
  33. *
  34. * @api private
  35. */
  36. private onOpen;
  37. /**
  38. * Called upon transport packet.
  39. *
  40. * @param {Object} packet
  41. * @api private
  42. */
  43. private onPacket;
  44. /**
  45. * Called upon transport error.
  46. *
  47. * @param {Error} error object
  48. * @api private
  49. */
  50. private onError;
  51. /**
  52. * Pings client every `this.pingInterval` and expects response
  53. * within `this.pingTimeout` or closes connection.
  54. *
  55. * @api private
  56. */
  57. private schedulePing;
  58. /**
  59. * Resets ping timeout.
  60. *
  61. * @api private
  62. */
  63. private resetPingTimeout;
  64. /**
  65. * Attaches handlers for the given transport.
  66. *
  67. * @param {Transport} transport
  68. * @api private
  69. */
  70. private setTransport;
  71. /**
  72. * Upgrades socket to the given transport
  73. *
  74. * @param {Transport} transport
  75. * @api private
  76. */
  77. private maybeUpgrade;
  78. /**
  79. * Clears listeners and timers associated with current transport.
  80. *
  81. * @api private
  82. */
  83. private clearTransport;
  84. /**
  85. * Called upon transport considered closed.
  86. * Possible reasons: `ping timeout`, `client error`, `parse error`,
  87. * `transport error`, `server close`, `transport close`
  88. */
  89. private onClose;
  90. /**
  91. * Setup and manage send callback
  92. *
  93. * @api private
  94. */
  95. private setupSendCallback;
  96. /**
  97. * Sends a message packet.
  98. *
  99. * @param {Object} data
  100. * @param {Object} options
  101. * @param {Function} callback
  102. * @return {Socket} for chaining
  103. * @api public
  104. */
  105. send(data: any, options: any, callback?: any): this;
  106. write(data: any, options: any, callback?: any): this;
  107. /**
  108. * Sends a packet.
  109. *
  110. * @param {String} type - packet type
  111. * @param {String} data
  112. * @param {Object} options
  113. * @param {Function} callback
  114. *
  115. * @api private
  116. */
  117. private sendPacket;
  118. /**
  119. * Attempts to flush the packets buffer.
  120. *
  121. * @api private
  122. */
  123. private flush;
  124. /**
  125. * Get available upgrades for this socket.
  126. *
  127. * @api private
  128. */
  129. private getAvailableUpgrades;
  130. /**
  131. * Closes the socket and underlying transport.
  132. *
  133. * @param {Boolean} discard - optional, discard the transport
  134. * @return {Socket} for chaining
  135. * @api public
  136. */
  137. close(discard?: boolean): void;
  138. /**
  139. * Closes the underlying transport.
  140. *
  141. * @param {Boolean} discard
  142. * @api private
  143. */
  144. private closeTransport;
  145. }