client.d.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /// <reference types="node" />
  2. import { IncomingMessage } from "http";
  3. import { Server } from "./index";
  4. import { Socket } from "./socket";
  5. export declare class Client {
  6. readonly conn: any;
  7. private readonly id;
  8. private readonly server;
  9. private readonly encoder;
  10. private readonly decoder;
  11. private sockets;
  12. private nsps;
  13. private connectTimeout;
  14. /**
  15. * Client constructor.
  16. *
  17. * @param {Server} server instance
  18. * @param {Socket} conn
  19. * @package
  20. */
  21. constructor(server: Server, conn: any);
  22. /**
  23. * @return the reference to the request that originated the Engine.IO connection
  24. *
  25. * @public
  26. */
  27. get request(): IncomingMessage;
  28. /**
  29. * Sets up event listeners.
  30. *
  31. * @private
  32. */
  33. private setup;
  34. /**
  35. * Connects a client to a namespace.
  36. *
  37. * @param {String} name - the namespace
  38. * @param {Object} auth - the auth parameters
  39. * @private
  40. */
  41. private connect;
  42. /**
  43. * Connects a client to a namespace.
  44. *
  45. * @param {String} name - the namespace
  46. * @param {Object} auth - the auth parameters
  47. *
  48. * @private
  49. */
  50. private doConnect;
  51. /**
  52. * Disconnects from all namespaces and closes transport.
  53. *
  54. * @private
  55. */
  56. _disconnect(): void;
  57. /**
  58. * Removes a socket. Called by each `Socket`.
  59. *
  60. * @private
  61. */
  62. _remove(socket: Socket): void;
  63. /**
  64. * Closes the underlying connection.
  65. *
  66. * @private
  67. */
  68. private close;
  69. /**
  70. * Writes a packet to the transport.
  71. *
  72. * @param {Object} packet object
  73. * @param {Object} opts
  74. * @private
  75. */
  76. _packet(packet: any, opts?: any): void;
  77. /**
  78. * Called with incoming transport data.
  79. *
  80. * @private
  81. */
  82. private ondata;
  83. /**
  84. * Called when parser fully decodes a packet.
  85. *
  86. * @private
  87. */
  88. private ondecoded;
  89. /**
  90. * Handles an error.
  91. *
  92. * @param {Object} err object
  93. * @private
  94. */
  95. private onerror;
  96. /**
  97. * Called upon transport close.
  98. *
  99. * @param reason
  100. * @private
  101. */
  102. private onclose;
  103. /**
  104. * Cleans up event listeners.
  105. * @private
  106. */
  107. private destroy;
  108. }