@wabot-dev/framework 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (361) hide show
  1. package/dist/src/channels/cmd/@cmd.js +1 -1
  2. package/dist/src/channels/cmd/CmdChannel.js +1 -1
  3. package/dist/src/channels/telegram/@telegram.js +1 -1
  4. package/dist/src/channels/telegram/TelegramChannel.js +1 -1
  5. package/dist/src/channels/whatsapp/@whatsapp.js +1 -1
  6. package/dist/src/channels/whatsapp/WhatsAppChannel.js +1 -1
  7. package/dist/src/channels/whatsapp/WhatsAppConnection.js +1 -1
  8. package/dist/src/channels/whatsapp/WhatsAppDevConnection.js +2 -2
  9. package/dist/src/channels/whatsapp/WhatsAppProdConnection.js +1 -1
  10. package/dist/src/controller/socket.io/SocketIO.js +1 -1
  11. package/dist/src/logger/Logger.js +1 -1
  12. package/dist/src/server/runChannel.js +1 -1
  13. package/dist/src/server/runServer.js +4 -4
  14. package/package.json +2 -1
  15. package/dist/src/_virtual/XMLHttpRequest.js +0 -7
  16. package/dist/src/_virtual/_commonjsHelpers.js +0 -32
  17. package/dist/src/_virtual/base64id.js +0 -3
  18. package/dist/src/_virtual/binary.js +0 -3
  19. package/dist/src/_virtual/bom-handling.js +0 -3
  20. package/dist/src/_virtual/broadcast-operator.js +0 -3
  21. package/dist/src/_virtual/browser.js +0 -3
  22. package/dist/src/_virtual/browser2.js +0 -3
  23. package/dist/src/_virtual/browser3.js +0 -3
  24. package/dist/src/_virtual/browser4.js +0 -3
  25. package/dist/src/_virtual/browser5.js +0 -3
  26. package/dist/src/_virtual/buffer-util.js +0 -3
  27. package/dist/src/_virtual/buffer-util2.js +0 -3
  28. package/dist/src/_virtual/buffer-util3.js +0 -3
  29. package/dist/src/_virtual/charset.js +0 -3
  30. package/dist/src/_virtual/charset2.js +0 -3
  31. package/dist/src/_virtual/client.js +0 -3
  32. package/dist/src/_virtual/cluster-adapter.js +0 -3
  33. package/dist/src/_virtual/commons.js +0 -3
  34. package/dist/src/_virtual/dbcs-codec.js +0 -3
  35. package/dist/src/_virtual/decodePacket.js +0 -3
  36. package/dist/src/_virtual/encodePacket.js +0 -3
  37. package/dist/src/_virtual/encoding.js +0 -3
  38. package/dist/src/_virtual/encoding2.js +0 -3
  39. package/dist/src/_virtual/engine.io.js +0 -3
  40. package/dist/src/_virtual/in-memory-adapter.js +0 -3
  41. package/dist/src/_virtual/index.js +0 -7
  42. package/dist/src/_virtual/index10.js +0 -3
  43. package/dist/src/_virtual/index11.js +0 -3
  44. package/dist/src/_virtual/index12.js +0 -3
  45. package/dist/src/_virtual/index13.js +0 -3
  46. package/dist/src/_virtual/index14.js +0 -3
  47. package/dist/src/_virtual/index15.js +0 -3
  48. package/dist/src/_virtual/index16.js +0 -3
  49. package/dist/src/_virtual/index17.js +0 -3
  50. package/dist/src/_virtual/index18.js +0 -3
  51. package/dist/src/_virtual/index19.js +0 -3
  52. package/dist/src/_virtual/index2.js +0 -7
  53. package/dist/src/_virtual/index20.js +0 -3
  54. package/dist/src/_virtual/index21.js +0 -3
  55. package/dist/src/_virtual/index22.js +0 -3
  56. package/dist/src/_virtual/index23.js +0 -3
  57. package/dist/src/_virtual/index24.js +0 -3
  58. package/dist/src/_virtual/index25.js +0 -3
  59. package/dist/src/_virtual/index26.js +0 -3
  60. package/dist/src/_virtual/index27.js +0 -3
  61. package/dist/src/_virtual/index28.js +0 -3
  62. package/dist/src/_virtual/index29.js +0 -3
  63. package/dist/src/_virtual/index3.js +0 -7
  64. package/dist/src/_virtual/index30.js +0 -3
  65. package/dist/src/_virtual/index31.js +0 -3
  66. package/dist/src/_virtual/index32.js +0 -3
  67. package/dist/src/_virtual/index33.js +0 -3
  68. package/dist/src/_virtual/index4.js +0 -3
  69. package/dist/src/_virtual/index5.js +0 -3
  70. package/dist/src/_virtual/index6.js +0 -3
  71. package/dist/src/_virtual/index7.js +0 -3
  72. package/dist/src/_virtual/index8.js +0 -6
  73. package/dist/src/_virtual/index9.js +0 -3
  74. package/dist/src/_virtual/inherits.js +0 -3
  75. package/dist/src/_virtual/inherits_browser.js +0 -3
  76. package/dist/src/_virtual/is-binary.js +0 -3
  77. package/dist/src/_virtual/language.js +0 -3
  78. package/dist/src/_virtual/language2.js +0 -3
  79. package/dist/src/_virtual/mediaType.js +0 -3
  80. package/dist/src/_virtual/mediaType2.js +0 -3
  81. package/dist/src/_virtual/namespace.js +0 -3
  82. package/dist/src/_virtual/node.js +0 -3
  83. package/dist/src/_virtual/node2.js +0 -3
  84. package/dist/src/_virtual/node3.js +0 -3
  85. package/dist/src/_virtual/node4.js +0 -3
  86. package/dist/src/_virtual/node5.js +0 -3
  87. package/dist/src/_virtual/parent-namespace.js +0 -3
  88. package/dist/src/_virtual/polling-jsonp.js +0 -3
  89. package/dist/src/_virtual/polling.js +0 -3
  90. package/dist/src/_virtual/polling2.js +0 -3
  91. package/dist/src/_virtual/receiver.js +0 -3
  92. package/dist/src/_virtual/sbcs-codec.js +0 -3
  93. package/dist/src/_virtual/sender.js +0 -3
  94. package/dist/src/_virtual/server.js +0 -3
  95. package/dist/src/_virtual/socket-types.js +0 -3
  96. package/dist/src/_virtual/socket.js +0 -3
  97. package/dist/src/_virtual/socket2.js +0 -3
  98. package/dist/src/_virtual/stream.js +0 -3
  99. package/dist/src/_virtual/transport.js +0 -3
  100. package/dist/src/_virtual/typed-events.js +0 -3
  101. package/dist/src/_virtual/userver.js +0 -3
  102. package/dist/src/_virtual/utf16.js +0 -3
  103. package/dist/src/_virtual/utf32.js +0 -3
  104. package/dist/src/_virtual/utf7.js +0 -3
  105. package/dist/src/_virtual/uws.js +0 -3
  106. package/dist/src/_virtual/validation.js +0 -3
  107. package/dist/src/_virtual/validation2.js +0 -3
  108. package/dist/src/_virtual/validation3.js +0 -3
  109. package/dist/src/_virtual/websocket-server.js +0 -3
  110. package/dist/src/_virtual/websocket.js +0 -7
  111. package/dist/src/_virtual/websocket2.js +0 -3
  112. package/dist/src/_virtual/websocket3.js +0 -3
  113. package/dist/src/_virtual/webtransport.js +0 -3
  114. package/dist/src/_virtual/yeast.js +0 -3
  115. package/dist/src/node_modules/@socket.io/component-emitter/lib/esm/index.js +0 -171
  116. package/dist/src/node_modules/base64id/lib/base64id.js +0 -117
  117. package/dist/src/node_modules/body-parser/index.js +0 -96
  118. package/dist/src/node_modules/body-parser/lib/read.js +0 -225
  119. package/dist/src/node_modules/body-parser/lib/types/json.js +0 -222
  120. package/dist/src/node_modules/body-parser/lib/types/raw.js +0 -90
  121. package/dist/src/node_modules/body-parser/lib/types/text.js +0 -95
  122. package/dist/src/node_modules/body-parser/lib/types/urlencoded.js +0 -194
  123. package/dist/src/node_modules/body-parser/lib/utils.js +0 -96
  124. package/dist/src/node_modules/bytes/index.js +0 -180
  125. package/dist/src/node_modules/call-bind-apply-helpers/actualApply.js +0 -24
  126. package/dist/src/node_modules/call-bind-apply-helpers/functionApply.js +0 -13
  127. package/dist/src/node_modules/call-bind-apply-helpers/functionCall.js +0 -13
  128. package/dist/src/node_modules/call-bind-apply-helpers/index.js +0 -29
  129. package/dist/src/node_modules/call-bind-apply-helpers/reflectApply.js +0 -13
  130. package/dist/src/node_modules/call-bound/index.js +0 -31
  131. package/dist/src/node_modules/content-type/index.js +0 -235
  132. package/dist/src/node_modules/cookie/index.js +0 -345
  133. package/dist/src/node_modules/cors/lib/index.js +0 -249
  134. package/dist/src/node_modules/debug/src/browser.js +0 -286
  135. package/dist/src/node_modules/debug/src/common.js +0 -303
  136. package/dist/src/node_modules/debug/src/index.js +0 -23
  137. package/dist/src/node_modules/debug/src/node.js +0 -279
  138. package/dist/src/node_modules/depd/index.js +0 -550
  139. package/dist/src/node_modules/dunder-proto/get.js +0 -42
  140. package/dist/src/node_modules/ee-first/index.js +0 -104
  141. package/dist/src/node_modules/engine.io/build/engine.io.js +0 -73
  142. package/dist/src/node_modules/engine.io/build/parser-v3/index.js +0 -429
  143. package/dist/src/node_modules/engine.io/build/parser-v3/utf8.js +0 -198
  144. package/dist/src/node_modules/engine.io/build/server.js +0 -808
  145. package/dist/src/node_modules/engine.io/build/socket.js +0 -469
  146. package/dist/src/node_modules/engine.io/build/transport.js +0 -131
  147. package/dist/src/node_modules/engine.io/build/transports/index.js +0 -37
  148. package/dist/src/node_modules/engine.io/build/transports/polling-jsonp.js +0 -53
  149. package/dist/src/node_modules/engine.io/build/transports/polling.js +0 -346
  150. package/dist/src/node_modules/engine.io/build/transports/websocket.js +0 -106
  151. package/dist/src/node_modules/engine.io/build/transports/webtransport.js +0 -76
  152. package/dist/src/node_modules/engine.io/build/transports-uws/index.js +0 -20
  153. package/dist/src/node_modules/engine.io/build/transports-uws/polling.js +0 -378
  154. package/dist/src/node_modules/engine.io/build/transports-uws/websocket.js +0 -85
  155. package/dist/src/node_modules/engine.io/build/userver.js +0 -292
  156. package/dist/src/node_modules/engine.io/node_modules/accepts/index.js +0 -250
  157. package/dist/src/node_modules/engine.io/node_modules/debug/src/browser.js +0 -285
  158. package/dist/src/node_modules/engine.io/node_modules/debug/src/common.js +0 -285
  159. package/dist/src/node_modules/engine.io/node_modules/debug/src/index.js +0 -23
  160. package/dist/src/node_modules/engine.io/node_modules/debug/src/node.js +0 -279
  161. package/dist/src/node_modules/engine.io/node_modules/mime-db/db.json.js +0 -10704
  162. package/dist/src/node_modules/engine.io/node_modules/mime-db/index.js +0 -24
  163. package/dist/src/node_modules/engine.io/node_modules/mime-types/index.js +0 -202
  164. package/dist/src/node_modules/engine.io/node_modules/negotiator/index.js +0 -96
  165. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/charset.js +0 -179
  166. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/encoding.js +0 -193
  167. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/language.js +0 -188
  168. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/mediaType.js +0 -304
  169. package/dist/src/node_modules/engine.io/node_modules/ws/index.js +0 -28
  170. package/dist/src/node_modules/engine.io/node_modules/ws/lib/buffer-util.js +0 -142
  171. package/dist/src/node_modules/engine.io/node_modules/ws/lib/constants.js +0 -21
  172. package/dist/src/node_modules/engine.io/node_modules/ws/lib/event-target.js +0 -303
  173. package/dist/src/node_modules/engine.io/node_modules/ws/lib/extension.js +0 -214
  174. package/dist/src/node_modules/engine.io/node_modules/ws/lib/limiter.js +0 -64
  175. package/dist/src/node_modules/engine.io/node_modules/ws/lib/permessage-deflate.js +0 -528
  176. package/dist/src/node_modules/engine.io/node_modules/ws/lib/receiver.js +0 -719
  177. package/dist/src/node_modules/engine.io/node_modules/ws/lib/sender.js +0 -513
  178. package/dist/src/node_modules/engine.io/node_modules/ws/lib/stream.js +0 -170
  179. package/dist/src/node_modules/engine.io/node_modules/ws/lib/subprotocol.js +0 -73
  180. package/dist/src/node_modules/engine.io/node_modules/ws/lib/validation.js +0 -141
  181. package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket-server.js +0 -559
  182. package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket.js +0 -1363
  183. package/dist/src/node_modules/engine.io-client/build/esm/contrib/has-cors.js +0 -13
  184. package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseqs.js +0 -36
  185. package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseuri.js +0 -66
  186. package/dist/src/node_modules/engine.io-client/build/esm/globals.node.js +0 -92
  187. package/dist/src/node_modules/engine.io-client/build/esm/index.js +0 -17
  188. package/dist/src/node_modules/engine.io-client/build/esm/socket.js +0 -728
  189. package/dist/src/node_modules/engine.io-client/build/esm/transport.js +0 -143
  190. package/dist/src/node_modules/engine.io-client/build/esm/transports/index.js +0 -11
  191. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +0 -256
  192. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.js +0 -21
  193. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling.js +0 -146
  194. package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.js +0 -107
  195. package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.node.js +0 -48
  196. package/dist/src/node_modules/engine.io-client/build/esm/transports/webtransport.js +0 -83
  197. package/dist/src/node_modules/engine.io-client/build/esm/util.js +0 -62
  198. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js +0 -142
  199. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/constants.js +0 -21
  200. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/event-target.js +0 -303
  201. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/extension.js +0 -214
  202. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/limiter.js +0 -64
  203. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js +0 -528
  204. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/receiver.js +0 -719
  205. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/sender.js +0 -513
  206. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/stream.js +0 -170
  207. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/subprotocol.js +0 -73
  208. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/validation.js +0 -141
  209. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket-server.js +0 -559
  210. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket.js +0 -1363
  211. package/dist/src/node_modules/engine.io-parser/build/cjs/commons.js +0 -29
  212. package/dist/src/node_modules/engine.io-parser/build/cjs/decodePacket.js +0 -70
  213. package/dist/src/node_modules/engine.io-parser/build/cjs/encodePacket.js +0 -51
  214. package/dist/src/node_modules/engine.io-parser/build/cjs/index.js +0 -179
  215. package/dist/src/node_modules/engine.io-parser/build/esm/commons.js +0 -15
  216. package/dist/src/node_modules/engine.io-parser/build/esm/decodePacket.js +0 -58
  217. package/dist/src/node_modules/engine.io-parser/build/esm/encodePacket.js +0 -36
  218. package/dist/src/node_modules/engine.io-parser/build/esm/index.js +0 -158
  219. package/dist/src/node_modules/es-define-property/index.js +0 -23
  220. package/dist/src/node_modules/es-errors/eval.js +0 -13
  221. package/dist/src/node_modules/es-errors/index.js +0 -13
  222. package/dist/src/node_modules/es-errors/range.js +0 -13
  223. package/dist/src/node_modules/es-errors/ref.js +0 -13
  224. package/dist/src/node_modules/es-errors/syntax.js +0 -13
  225. package/dist/src/node_modules/es-errors/type.js +0 -13
  226. package/dist/src/node_modules/es-errors/uri.js +0 -13
  227. package/dist/src/node_modules/es-object-atoms/index.js +0 -13
  228. package/dist/src/node_modules/function-bind/implementation.js +0 -93
  229. package/dist/src/node_modules/function-bind/index.js +0 -16
  230. package/dist/src/node_modules/get-intrinsic/index.js +0 -413
  231. package/dist/src/node_modules/get-proto/Object.getPrototypeOf.js +0 -17
  232. package/dist/src/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -13
  233. package/dist/src/node_modules/get-proto/index.js +0 -40
  234. package/dist/src/node_modules/gopd/gOPD.js +0 -13
  235. package/dist/src/node_modules/gopd/index.js +0 -26
  236. package/dist/src/node_modules/has-symbols/index.js +0 -25
  237. package/dist/src/node_modules/has-symbols/shams.js +0 -54
  238. package/dist/src/node_modules/hasown/index.js +0 -19
  239. package/dist/src/node_modules/http-errors/index.js +0 -306
  240. package/dist/src/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -598
  241. package/dist/src/node_modules/iconv-lite/encodings/dbcs-data.js +0 -206
  242. package/dist/src/node_modules/iconv-lite/encodings/index.js +0 -44
  243. package/dist/src/node_modules/iconv-lite/encodings/internal.js +0 -210
  244. package/dist/src/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -83
  245. package/dist/src/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -460
  246. package/dist/src/node_modules/iconv-lite/encodings/sbcs-data.js +0 -187
  247. package/dist/src/node_modules/iconv-lite/encodings/tables/big5-added.json.js +0 -506
  248. package/dist/src/node_modules/iconv-lite/encodings/tables/cp936.json.js +0 -2621
  249. package/dist/src/node_modules/iconv-lite/encodings/tables/cp949.json.js +0 -2380
  250. package/dist/src/node_modules/iconv-lite/encodings/tables/cp950.json.js +0 -729
  251. package/dist/src/node_modules/iconv-lite/encodings/tables/eucjp.json.js +0 -822
  252. package/dist/src/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json.js +0 -424
  253. package/dist/src/node_modules/iconv-lite/encodings/tables/gbk-added.json.js +0 -264
  254. package/dist/src/node_modules/iconv-lite/encodings/tables/shiftjis.json.js +0 -548
  255. package/dist/src/node_modules/iconv-lite/encodings/utf16.js +0 -206
  256. package/dist/src/node_modules/iconv-lite/encodings/utf32.js +0 -329
  257. package/dist/src/node_modules/iconv-lite/encodings/utf7.js +0 -297
  258. package/dist/src/node_modules/iconv-lite/lib/bom-handling.js +0 -61
  259. package/dist/src/node_modules/iconv-lite/lib/index.js +0 -192
  260. package/dist/src/node_modules/iconv-lite/lib/streams.js +0 -120
  261. package/dist/src/node_modules/inherits/inherits.js +0 -21
  262. package/dist/src/node_modules/inherits/inherits_browser.js +0 -38
  263. package/dist/src/node_modules/math-intrinsics/abs.js +0 -13
  264. package/dist/src/node_modules/math-intrinsics/floor.js +0 -13
  265. package/dist/src/node_modules/math-intrinsics/isNaN.js +0 -15
  266. package/dist/src/node_modules/math-intrinsics/max.js +0 -13
  267. package/dist/src/node_modules/math-intrinsics/min.js +0 -13
  268. package/dist/src/node_modules/math-intrinsics/pow.js +0 -13
  269. package/dist/src/node_modules/math-intrinsics/round.js +0 -13
  270. package/dist/src/node_modules/math-intrinsics/sign.js +0 -22
  271. package/dist/src/node_modules/media-typer/index.js +0 -153
  272. package/dist/src/node_modules/mime-db/db.json.js +0 -11656
  273. package/dist/src/node_modules/mime-db/index.js +0 -24
  274. package/dist/src/node_modules/mime-types/index.js +0 -226
  275. package/dist/src/node_modules/mime-types/mimeScore.js +0 -62
  276. package/dist/src/node_modules/ms/index.js +0 -172
  277. package/dist/src/node_modules/object-assign/index.js +0 -99
  278. package/dist/src/node_modules/object-inspect/index.js +0 -557
  279. package/dist/src/node_modules/object-inspect/util.inspect.js +0 -13
  280. package/dist/src/node_modules/on-finished/index.js +0 -245
  281. package/dist/src/node_modules/qs/lib/formats.js +0 -32
  282. package/dist/src/node_modules/qs/lib/index.js +0 -24
  283. package/dist/src/node_modules/qs/lib/parse.js +0 -339
  284. package/dist/src/node_modules/qs/lib/stringify.js +0 -369
  285. package/dist/src/node_modules/qs/lib/utils.js +0 -279
  286. package/dist/src/node_modules/raw-body/index.js +0 -351
  287. package/dist/src/node_modules/safer-buffer/safer.js +0 -88
  288. package/dist/src/node_modules/setprototypeof/index.js +0 -26
  289. package/dist/src/node_modules/side-channel/index.js +0 -58
  290. package/dist/src/node_modules/side-channel-list/index.js +0 -125
  291. package/dist/src/node_modules/side-channel-map/index.js +0 -82
  292. package/dist/src/node_modules/side-channel-weakmap/index.js +0 -99
  293. package/dist/src/node_modules/socket.io/dist/broadcast-operator.js +0 -448
  294. package/dist/src/node_modules/socket.io/dist/client.js +0 -281
  295. package/dist/src/node_modules/socket.io/dist/index.js +0 -837
  296. package/dist/src/node_modules/socket.io/dist/namespace.js +0 -597
  297. package/dist/src/node_modules/socket.io/dist/parent-namespace.js +0 -101
  298. package/dist/src/node_modules/socket.io/dist/socket-types.js +0 -21
  299. package/dist/src/node_modules/socket.io/dist/socket.js +0 -993
  300. package/dist/src/node_modules/socket.io/dist/typed-events.js +0 -92
  301. package/dist/src/node_modules/socket.io/dist/uws.js +0 -149
  302. package/dist/src/node_modules/socket.io/node_modules/accepts/index.js +0 -250
  303. package/dist/src/node_modules/socket.io/node_modules/debug/src/browser.js +0 -285
  304. package/dist/src/node_modules/socket.io/node_modules/debug/src/common.js +0 -285
  305. package/dist/src/node_modules/socket.io/node_modules/debug/src/index.js +0 -23
  306. package/dist/src/node_modules/socket.io/node_modules/debug/src/node.js +0 -279
  307. package/dist/src/node_modules/socket.io/node_modules/mime-db/db.json.js +0 -10704
  308. package/dist/src/node_modules/socket.io/node_modules/mime-db/index.js +0 -24
  309. package/dist/src/node_modules/socket.io/node_modules/mime-types/index.js +0 -202
  310. package/dist/src/node_modules/socket.io/node_modules/negotiator/index.js +0 -96
  311. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/charset.js +0 -179
  312. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/encoding.js +0 -193
  313. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/language.js +0 -188
  314. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/mediaType.js +0 -304
  315. package/dist/src/node_modules/socket.io/package.json.js +0 -5
  316. package/dist/src/node_modules/socket.io/wrapper.js +0 -5
  317. package/dist/src/node_modules/socket.io-adapter/dist/cluster-adapter.js +0 -689
  318. package/dist/src/node_modules/socket.io-adapter/dist/contrib/yeast.js +0 -64
  319. package/dist/src/node_modules/socket.io-adapter/dist/in-memory-adapter.js +0 -407
  320. package/dist/src/node_modules/socket.io-adapter/dist/index.js +0 -24
  321. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/browser.js +0 -285
  322. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/common.js +0 -285
  323. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/index.js +0 -23
  324. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/node.js +0 -279
  325. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/index.js +0 -28
  326. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/buffer-util.js +0 -142
  327. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/constants.js +0 -21
  328. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/event-target.js +0 -303
  329. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/extension.js +0 -214
  330. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/limiter.js +0 -64
  331. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/permessage-deflate.js +0 -528
  332. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/receiver.js +0 -719
  333. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/sender.js +0 -513
  334. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/stream.js +0 -170
  335. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/subprotocol.js +0 -73
  336. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/validation.js +0 -141
  337. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket-server.js +0 -559
  338. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket.js +0 -1363
  339. package/dist/src/node_modules/socket.io-client/build/esm/contrib/backo2.js +0 -68
  340. package/dist/src/node_modules/socket.io-client/build/esm/index.js +0 -50
  341. package/dist/src/node_modules/socket.io-client/build/esm/manager.js +0 -373
  342. package/dist/src/node_modules/socket.io-client/build/esm/on.js +0 -8
  343. package/dist/src/node_modules/socket.io-client/build/esm/socket.js +0 -884
  344. package/dist/src/node_modules/socket.io-client/build/esm/url.js +0 -63
  345. package/dist/src/node_modules/socket.io-parser/build/cjs/binary.js +0 -99
  346. package/dist/src/node_modules/socket.io-parser/build/cjs/index.js +0 -337
  347. package/dist/src/node_modules/socket.io-parser/build/cjs/is-binary.js +0 -65
  348. package/dist/src/node_modules/socket.io-parser/build/esm/binary.js +0 -86
  349. package/dist/src/node_modules/socket.io-parser/build/esm/index.js +0 -314
  350. package/dist/src/node_modules/socket.io-parser/build/esm/is-binary.js +0 -52
  351. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/browser.js +0 -285
  352. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/common.js +0 -285
  353. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/index.js +0 -23
  354. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/node.js +0 -279
  355. package/dist/src/node_modules/statuses/codes.json.js +0 -67
  356. package/dist/src/node_modules/statuses/index.js +0 -157
  357. package/dist/src/node_modules/toidentifier/index.js +0 -41
  358. package/dist/src/node_modules/type-is/index.js +0 -263
  359. package/dist/src/node_modules/unpipe/index.js +0 -78
  360. package/dist/src/node_modules/vary/index.js +0 -159
  361. package/dist/src/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js +0 -702
@@ -1,884 +0,0 @@
1
- import { PacketType } from '../../../socket.io-parser/build/esm/index.js';
2
- import { on } from './on.js';
3
- import { Emitter } from '../../../@socket.io/component-emitter/lib/esm/index.js';
4
-
5
- /**
6
- * Internal events.
7
- * These events can't be emitted by the user.
8
- */
9
- const RESERVED_EVENTS = Object.freeze({
10
- connect: 1,
11
- connect_error: 1,
12
- disconnect: 1,
13
- disconnecting: 1,
14
- // EventEmitter reserved events: https://nodejs.org/api/events.html#events_event_newlistener
15
- newListener: 1,
16
- removeListener: 1,
17
- });
18
- /**
19
- * A Socket is the fundamental class for interacting with the server.
20
- *
21
- * A Socket belongs to a certain Namespace (by default /) and uses an underlying {@link Manager} to communicate.
22
- *
23
- * @example
24
- * const socket = io();
25
- *
26
- * socket.on("connect", () => {
27
- * console.log("connected");
28
- * });
29
- *
30
- * // send an event to the server
31
- * socket.emit("foo", "bar");
32
- *
33
- * socket.on("foobar", () => {
34
- * // an event was received from the server
35
- * });
36
- *
37
- * // upon disconnection
38
- * socket.on("disconnect", (reason) => {
39
- * console.log(`disconnected due to ${reason}`);
40
- * });
41
- */
42
- class Socket extends Emitter {
43
- /**
44
- * `Socket` constructor.
45
- */
46
- constructor(io, nsp, opts) {
47
- super();
48
- /**
49
- * Whether the socket is currently connected to the server.
50
- *
51
- * @example
52
- * const socket = io();
53
- *
54
- * socket.on("connect", () => {
55
- * console.log(socket.connected); // true
56
- * });
57
- *
58
- * socket.on("disconnect", () => {
59
- * console.log(socket.connected); // false
60
- * });
61
- */
62
- this.connected = false;
63
- /**
64
- * Whether the connection state was recovered after a temporary disconnection. In that case, any missed packets will
65
- * be transmitted by the server.
66
- */
67
- this.recovered = false;
68
- /**
69
- * Buffer for packets received before the CONNECT packet
70
- */
71
- this.receiveBuffer = [];
72
- /**
73
- * Buffer for packets that will be sent once the socket is connected
74
- */
75
- this.sendBuffer = [];
76
- /**
77
- * The queue of packets to be sent with retry in case of failure.
78
- *
79
- * Packets are sent one by one, each waiting for the server acknowledgement, in order to guarantee the delivery order.
80
- * @private
81
- */
82
- this._queue = [];
83
- /**
84
- * A sequence to generate the ID of the {@link QueuedPacket}.
85
- * @private
86
- */
87
- this._queueSeq = 0;
88
- this.ids = 0;
89
- /**
90
- * A map containing acknowledgement handlers.
91
- *
92
- * The `withError` attribute is used to differentiate handlers that accept an error as first argument:
93
- *
94
- * - `socket.emit("test", (err, value) => { ... })` with `ackTimeout` option
95
- * - `socket.timeout(5000).emit("test", (err, value) => { ... })`
96
- * - `const value = await socket.emitWithAck("test")`
97
- *
98
- * From those that don't:
99
- *
100
- * - `socket.emit("test", (value) => { ... });`
101
- *
102
- * In the first case, the handlers will be called with an error when:
103
- *
104
- * - the timeout is reached
105
- * - the socket gets disconnected
106
- *
107
- * In the second case, the handlers will be simply discarded upon disconnection, since the client will never receive
108
- * an acknowledgement from the server.
109
- *
110
- * @private
111
- */
112
- this.acks = {};
113
- this.flags = {};
114
- this.io = io;
115
- this.nsp = nsp;
116
- if (opts && opts.auth) {
117
- this.auth = opts.auth;
118
- }
119
- this._opts = Object.assign({}, opts);
120
- if (this.io._autoConnect)
121
- this.open();
122
- }
123
- /**
124
- * Whether the socket is currently disconnected
125
- *
126
- * @example
127
- * const socket = io();
128
- *
129
- * socket.on("connect", () => {
130
- * console.log(socket.disconnected); // false
131
- * });
132
- *
133
- * socket.on("disconnect", () => {
134
- * console.log(socket.disconnected); // true
135
- * });
136
- */
137
- get disconnected() {
138
- return !this.connected;
139
- }
140
- /**
141
- * Subscribe to open, close and packet events
142
- *
143
- * @private
144
- */
145
- subEvents() {
146
- if (this.subs)
147
- return;
148
- const io = this.io;
149
- this.subs = [
150
- on(io, "open", this.onopen.bind(this)),
151
- on(io, "packet", this.onpacket.bind(this)),
152
- on(io, "error", this.onerror.bind(this)),
153
- on(io, "close", this.onclose.bind(this)),
154
- ];
155
- }
156
- /**
157
- * Whether the Socket will try to reconnect when its Manager connects or reconnects.
158
- *
159
- * @example
160
- * const socket = io();
161
- *
162
- * console.log(socket.active); // true
163
- *
164
- * socket.on("disconnect", (reason) => {
165
- * if (reason === "io server disconnect") {
166
- * // the disconnection was initiated by the server, you need to manually reconnect
167
- * console.log(socket.active); // false
168
- * }
169
- * // else the socket will automatically try to reconnect
170
- * console.log(socket.active); // true
171
- * });
172
- */
173
- get active() {
174
- return !!this.subs;
175
- }
176
- /**
177
- * "Opens" the socket.
178
- *
179
- * @example
180
- * const socket = io({
181
- * autoConnect: false
182
- * });
183
- *
184
- * socket.connect();
185
- */
186
- connect() {
187
- if (this.connected)
188
- return this;
189
- this.subEvents();
190
- if (!this.io["_reconnecting"])
191
- this.io.open(); // ensure open
192
- if ("open" === this.io._readyState)
193
- this.onopen();
194
- return this;
195
- }
196
- /**
197
- * Alias for {@link connect()}.
198
- */
199
- open() {
200
- return this.connect();
201
- }
202
- /**
203
- * Sends a `message` event.
204
- *
205
- * This method mimics the WebSocket.send() method.
206
- *
207
- * @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/send
208
- *
209
- * @example
210
- * socket.send("hello");
211
- *
212
- * // this is equivalent to
213
- * socket.emit("message", "hello");
214
- *
215
- * @return self
216
- */
217
- send(...args) {
218
- args.unshift("message");
219
- this.emit.apply(this, args);
220
- return this;
221
- }
222
- /**
223
- * Override `emit`.
224
- * If the event is in `events`, it's emitted normally.
225
- *
226
- * @example
227
- * socket.emit("hello", "world");
228
- *
229
- * // all serializable datastructures are supported (no need to call JSON.stringify)
230
- * socket.emit("hello", 1, "2", { 3: ["4"], 5: Uint8Array.from([6]) });
231
- *
232
- * // with an acknowledgement from the server
233
- * socket.emit("hello", "world", (val) => {
234
- * // ...
235
- * });
236
- *
237
- * @return self
238
- */
239
- emit(ev, ...args) {
240
- var _a, _b, _c;
241
- if (RESERVED_EVENTS.hasOwnProperty(ev)) {
242
- throw new Error('"' + ev.toString() + '" is a reserved event name');
243
- }
244
- args.unshift(ev);
245
- if (this._opts.retries && !this.flags.fromQueue && !this.flags.volatile) {
246
- this._addToQueue(args);
247
- return this;
248
- }
249
- const packet = {
250
- type: PacketType.EVENT,
251
- data: args,
252
- };
253
- packet.options = {};
254
- packet.options.compress = this.flags.compress !== false;
255
- // event ack callback
256
- if ("function" === typeof args[args.length - 1]) {
257
- const id = this.ids++;
258
- const ack = args.pop();
259
- this._registerAckCallback(id, ack);
260
- packet.id = id;
261
- }
262
- const isTransportWritable = (_b = (_a = this.io.engine) === null || _a === void 0 ? void 0 : _a.transport) === null || _b === void 0 ? void 0 : _b.writable;
263
- const isConnected = this.connected && !((_c = this.io.engine) === null || _c === void 0 ? void 0 : _c._hasPingExpired());
264
- const discardPacket = this.flags.volatile && !isTransportWritable;
265
- if (discardPacket) ;
266
- else if (isConnected) {
267
- this.notifyOutgoingListeners(packet);
268
- this.packet(packet);
269
- }
270
- else {
271
- this.sendBuffer.push(packet);
272
- }
273
- this.flags = {};
274
- return this;
275
- }
276
- /**
277
- * @private
278
- */
279
- _registerAckCallback(id, ack) {
280
- var _a;
281
- const timeout = (_a = this.flags.timeout) !== null && _a !== void 0 ? _a : this._opts.ackTimeout;
282
- if (timeout === undefined) {
283
- this.acks[id] = ack;
284
- return;
285
- }
286
- // @ts-ignore
287
- const timer = this.io.setTimeoutFn(() => {
288
- delete this.acks[id];
289
- for (let i = 0; i < this.sendBuffer.length; i++) {
290
- if (this.sendBuffer[i].id === id) {
291
- this.sendBuffer.splice(i, 1);
292
- }
293
- }
294
- ack.call(this, new Error("operation has timed out"));
295
- }, timeout);
296
- const fn = (...args) => {
297
- // @ts-ignore
298
- this.io.clearTimeoutFn(timer);
299
- ack.apply(this, args);
300
- };
301
- fn.withError = true;
302
- this.acks[id] = fn;
303
- }
304
- /**
305
- * Emits an event and waits for an acknowledgement
306
- *
307
- * @example
308
- * // without timeout
309
- * const response = await socket.emitWithAck("hello", "world");
310
- *
311
- * // with a specific timeout
312
- * try {
313
- * const response = await socket.timeout(1000).emitWithAck("hello", "world");
314
- * } catch (err) {
315
- * // the server did not acknowledge the event in the given delay
316
- * }
317
- *
318
- * @return a Promise that will be fulfilled when the server acknowledges the event
319
- */
320
- emitWithAck(ev, ...args) {
321
- return new Promise((resolve, reject) => {
322
- const fn = (arg1, arg2) => {
323
- return arg1 ? reject(arg1) : resolve(arg2);
324
- };
325
- fn.withError = true;
326
- args.push(fn);
327
- this.emit(ev, ...args);
328
- });
329
- }
330
- /**
331
- * Add the packet to the queue.
332
- * @param args
333
- * @private
334
- */
335
- _addToQueue(args) {
336
- let ack;
337
- if (typeof args[args.length - 1] === "function") {
338
- ack = args.pop();
339
- }
340
- const packet = {
341
- id: this._queueSeq++,
342
- tryCount: 0,
343
- pending: false,
344
- args,
345
- flags: Object.assign({ fromQueue: true }, this.flags),
346
- };
347
- args.push((err, ...responseArgs) => {
348
- if (packet !== this._queue[0]) {
349
- // the packet has already been acknowledged
350
- return;
351
- }
352
- const hasError = err !== null;
353
- if (hasError) {
354
- if (packet.tryCount > this._opts.retries) {
355
- this._queue.shift();
356
- if (ack) {
357
- ack(err);
358
- }
359
- }
360
- }
361
- else {
362
- this._queue.shift();
363
- if (ack) {
364
- ack(null, ...responseArgs);
365
- }
366
- }
367
- packet.pending = false;
368
- return this._drainQueue();
369
- });
370
- this._queue.push(packet);
371
- this._drainQueue();
372
- }
373
- /**
374
- * Send the first packet of the queue, and wait for an acknowledgement from the server.
375
- * @param force - whether to resend a packet that has not been acknowledged yet
376
- *
377
- * @private
378
- */
379
- _drainQueue(force = false) {
380
- if (!this.connected || this._queue.length === 0) {
381
- return;
382
- }
383
- const packet = this._queue[0];
384
- if (packet.pending && !force) {
385
- return;
386
- }
387
- packet.pending = true;
388
- packet.tryCount++;
389
- this.flags = packet.flags;
390
- this.emit.apply(this, packet.args);
391
- }
392
- /**
393
- * Sends a packet.
394
- *
395
- * @param packet
396
- * @private
397
- */
398
- packet(packet) {
399
- packet.nsp = this.nsp;
400
- this.io._packet(packet);
401
- }
402
- /**
403
- * Called upon engine `open`.
404
- *
405
- * @private
406
- */
407
- onopen() {
408
- if (typeof this.auth == "function") {
409
- this.auth((data) => {
410
- this._sendConnectPacket(data);
411
- });
412
- }
413
- else {
414
- this._sendConnectPacket(this.auth);
415
- }
416
- }
417
- /**
418
- * Sends a CONNECT packet to initiate the Socket.IO session.
419
- *
420
- * @param data
421
- * @private
422
- */
423
- _sendConnectPacket(data) {
424
- this.packet({
425
- type: PacketType.CONNECT,
426
- data: this._pid
427
- ? Object.assign({ pid: this._pid, offset: this._lastOffset }, data)
428
- : data,
429
- });
430
- }
431
- /**
432
- * Called upon engine or manager `error`.
433
- *
434
- * @param err
435
- * @private
436
- */
437
- onerror(err) {
438
- if (!this.connected) {
439
- this.emitReserved("connect_error", err);
440
- }
441
- }
442
- /**
443
- * Called upon engine `close`.
444
- *
445
- * @param reason
446
- * @param description
447
- * @private
448
- */
449
- onclose(reason, description) {
450
- this.connected = false;
451
- delete this.id;
452
- this.emitReserved("disconnect", reason, description);
453
- this._clearAcks();
454
- }
455
- /**
456
- * Clears the acknowledgement handlers upon disconnection, since the client will never receive an acknowledgement from
457
- * the server.
458
- *
459
- * @private
460
- */
461
- _clearAcks() {
462
- Object.keys(this.acks).forEach((id) => {
463
- const isBuffered = this.sendBuffer.some((packet) => String(packet.id) === id);
464
- if (!isBuffered) {
465
- // note: handlers that do not accept an error as first argument are ignored here
466
- const ack = this.acks[id];
467
- delete this.acks[id];
468
- if (ack.withError) {
469
- ack.call(this, new Error("socket has been disconnected"));
470
- }
471
- }
472
- });
473
- }
474
- /**
475
- * Called with socket packet.
476
- *
477
- * @param packet
478
- * @private
479
- */
480
- onpacket(packet) {
481
- const sameNamespace = packet.nsp === this.nsp;
482
- if (!sameNamespace)
483
- return;
484
- switch (packet.type) {
485
- case PacketType.CONNECT:
486
- if (packet.data && packet.data.sid) {
487
- this.onconnect(packet.data.sid, packet.data.pid);
488
- }
489
- else {
490
- this.emitReserved("connect_error", new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));
491
- }
492
- break;
493
- case PacketType.EVENT:
494
- case PacketType.BINARY_EVENT:
495
- this.onevent(packet);
496
- break;
497
- case PacketType.ACK:
498
- case PacketType.BINARY_ACK:
499
- this.onack(packet);
500
- break;
501
- case PacketType.DISCONNECT:
502
- this.ondisconnect();
503
- break;
504
- case PacketType.CONNECT_ERROR:
505
- this.destroy();
506
- const err = new Error(packet.data.message);
507
- // @ts-ignore
508
- err.data = packet.data.data;
509
- this.emitReserved("connect_error", err);
510
- break;
511
- }
512
- }
513
- /**
514
- * Called upon a server event.
515
- *
516
- * @param packet
517
- * @private
518
- */
519
- onevent(packet) {
520
- const args = packet.data || [];
521
- if (null != packet.id) {
522
- args.push(this.ack(packet.id));
523
- }
524
- if (this.connected) {
525
- this.emitEvent(args);
526
- }
527
- else {
528
- this.receiveBuffer.push(Object.freeze(args));
529
- }
530
- }
531
- emitEvent(args) {
532
- if (this._anyListeners && this._anyListeners.length) {
533
- const listeners = this._anyListeners.slice();
534
- for (const listener of listeners) {
535
- listener.apply(this, args);
536
- }
537
- }
538
- super.emit.apply(this, args);
539
- if (this._pid && args.length && typeof args[args.length - 1] === "string") {
540
- this._lastOffset = args[args.length - 1];
541
- }
542
- }
543
- /**
544
- * Produces an ack callback to emit with an event.
545
- *
546
- * @private
547
- */
548
- ack(id) {
549
- const self = this;
550
- let sent = false;
551
- return function (...args) {
552
- // prevent double callbacks
553
- if (sent)
554
- return;
555
- sent = true;
556
- self.packet({
557
- type: PacketType.ACK,
558
- id: id,
559
- data: args,
560
- });
561
- };
562
- }
563
- /**
564
- * Called upon a server acknowledgement.
565
- *
566
- * @param packet
567
- * @private
568
- */
569
- onack(packet) {
570
- const ack = this.acks[packet.id];
571
- if (typeof ack !== "function") {
572
- return;
573
- }
574
- delete this.acks[packet.id];
575
- // @ts-ignore FIXME ack is incorrectly inferred as 'never'
576
- if (ack.withError) {
577
- packet.data.unshift(null);
578
- }
579
- // @ts-ignore
580
- ack.apply(this, packet.data);
581
- }
582
- /**
583
- * Called upon server connect.
584
- *
585
- * @private
586
- */
587
- onconnect(id, pid) {
588
- this.id = id;
589
- this.recovered = pid && this._pid === pid;
590
- this._pid = pid; // defined only if connection state recovery is enabled
591
- this.connected = true;
592
- this.emitBuffered();
593
- this.emitReserved("connect");
594
- this._drainQueue(true);
595
- }
596
- /**
597
- * Emit buffered events (received and emitted).
598
- *
599
- * @private
600
- */
601
- emitBuffered() {
602
- this.receiveBuffer.forEach((args) => this.emitEvent(args));
603
- this.receiveBuffer = [];
604
- this.sendBuffer.forEach((packet) => {
605
- this.notifyOutgoingListeners(packet);
606
- this.packet(packet);
607
- });
608
- this.sendBuffer = [];
609
- }
610
- /**
611
- * Called upon server disconnect.
612
- *
613
- * @private
614
- */
615
- ondisconnect() {
616
- this.destroy();
617
- this.onclose("io server disconnect");
618
- }
619
- /**
620
- * Called upon forced client/server side disconnections,
621
- * this method ensures the manager stops tracking us and
622
- * that reconnections don't get triggered for this.
623
- *
624
- * @private
625
- */
626
- destroy() {
627
- if (this.subs) {
628
- // clean subscriptions to avoid reconnections
629
- this.subs.forEach((subDestroy) => subDestroy());
630
- this.subs = undefined;
631
- }
632
- this.io["_destroy"](this);
633
- }
634
- /**
635
- * Disconnects the socket manually. In that case, the socket will not try to reconnect.
636
- *
637
- * If this is the last active Socket instance of the {@link Manager}, the low-level connection will be closed.
638
- *
639
- * @example
640
- * const socket = io();
641
- *
642
- * socket.on("disconnect", (reason) => {
643
- * // console.log(reason); prints "io client disconnect"
644
- * });
645
- *
646
- * socket.disconnect();
647
- *
648
- * @return self
649
- */
650
- disconnect() {
651
- if (this.connected) {
652
- this.packet({ type: PacketType.DISCONNECT });
653
- }
654
- // remove socket from pool
655
- this.destroy();
656
- if (this.connected) {
657
- // fire events
658
- this.onclose("io client disconnect");
659
- }
660
- return this;
661
- }
662
- /**
663
- * Alias for {@link disconnect()}.
664
- *
665
- * @return self
666
- */
667
- close() {
668
- return this.disconnect();
669
- }
670
- /**
671
- * Sets the compress flag.
672
- *
673
- * @example
674
- * socket.compress(false).emit("hello");
675
- *
676
- * @param compress - if `true`, compresses the sending data
677
- * @return self
678
- */
679
- compress(compress) {
680
- this.flags.compress = compress;
681
- return this;
682
- }
683
- /**
684
- * Sets a modifier for a subsequent event emission that the event message will be dropped when this socket is not
685
- * ready to send messages.
686
- *
687
- * @example
688
- * socket.volatile.emit("hello"); // the server may or may not receive it
689
- *
690
- * @returns self
691
- */
692
- get volatile() {
693
- this.flags.volatile = true;
694
- return this;
695
- }
696
- /**
697
- * Sets a modifier for a subsequent event emission that the callback will be called with an error when the
698
- * given number of milliseconds have elapsed without an acknowledgement from the server:
699
- *
700
- * @example
701
- * socket.timeout(5000).emit("my-event", (err) => {
702
- * if (err) {
703
- * // the server did not acknowledge the event in the given delay
704
- * }
705
- * });
706
- *
707
- * @returns self
708
- */
709
- timeout(timeout) {
710
- this.flags.timeout = timeout;
711
- return this;
712
- }
713
- /**
714
- * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
715
- * callback.
716
- *
717
- * @example
718
- * socket.onAny((event, ...args) => {
719
- * console.log(`got ${event}`);
720
- * });
721
- *
722
- * @param listener
723
- */
724
- onAny(listener) {
725
- this._anyListeners = this._anyListeners || [];
726
- this._anyListeners.push(listener);
727
- return this;
728
- }
729
- /**
730
- * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
731
- * callback. The listener is added to the beginning of the listeners array.
732
- *
733
- * @example
734
- * socket.prependAny((event, ...args) => {
735
- * console.log(`got event ${event}`);
736
- * });
737
- *
738
- * @param listener
739
- */
740
- prependAny(listener) {
741
- this._anyListeners = this._anyListeners || [];
742
- this._anyListeners.unshift(listener);
743
- return this;
744
- }
745
- /**
746
- * Removes the listener that will be fired when any event is emitted.
747
- *
748
- * @example
749
- * const catchAllListener = (event, ...args) => {
750
- * console.log(`got event ${event}`);
751
- * }
752
- *
753
- * socket.onAny(catchAllListener);
754
- *
755
- * // remove a specific listener
756
- * socket.offAny(catchAllListener);
757
- *
758
- * // or remove all listeners
759
- * socket.offAny();
760
- *
761
- * @param listener
762
- */
763
- offAny(listener) {
764
- if (!this._anyListeners) {
765
- return this;
766
- }
767
- if (listener) {
768
- const listeners = this._anyListeners;
769
- for (let i = 0; i < listeners.length; i++) {
770
- if (listener === listeners[i]) {
771
- listeners.splice(i, 1);
772
- return this;
773
- }
774
- }
775
- }
776
- else {
777
- this._anyListeners = [];
778
- }
779
- return this;
780
- }
781
- /**
782
- * Returns an array of listeners that are listening for any event that is specified. This array can be manipulated,
783
- * e.g. to remove listeners.
784
- */
785
- listenersAny() {
786
- return this._anyListeners || [];
787
- }
788
- /**
789
- * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
790
- * callback.
791
- *
792
- * Note: acknowledgements sent to the server are not included.
793
- *
794
- * @example
795
- * socket.onAnyOutgoing((event, ...args) => {
796
- * console.log(`sent event ${event}`);
797
- * });
798
- *
799
- * @param listener
800
- */
801
- onAnyOutgoing(listener) {
802
- this._anyOutgoingListeners = this._anyOutgoingListeners || [];
803
- this._anyOutgoingListeners.push(listener);
804
- return this;
805
- }
806
- /**
807
- * Adds a listener that will be fired when any event is emitted. The event name is passed as the first argument to the
808
- * callback. The listener is added to the beginning of the listeners array.
809
- *
810
- * Note: acknowledgements sent to the server are not included.
811
- *
812
- * @example
813
- * socket.prependAnyOutgoing((event, ...args) => {
814
- * console.log(`sent event ${event}`);
815
- * });
816
- *
817
- * @param listener
818
- */
819
- prependAnyOutgoing(listener) {
820
- this._anyOutgoingListeners = this._anyOutgoingListeners || [];
821
- this._anyOutgoingListeners.unshift(listener);
822
- return this;
823
- }
824
- /**
825
- * Removes the listener that will be fired when any event is emitted.
826
- *
827
- * @example
828
- * const catchAllListener = (event, ...args) => {
829
- * console.log(`sent event ${event}`);
830
- * }
831
- *
832
- * socket.onAnyOutgoing(catchAllListener);
833
- *
834
- * // remove a specific listener
835
- * socket.offAnyOutgoing(catchAllListener);
836
- *
837
- * // or remove all listeners
838
- * socket.offAnyOutgoing();
839
- *
840
- * @param [listener] - the catch-all listener (optional)
841
- */
842
- offAnyOutgoing(listener) {
843
- if (!this._anyOutgoingListeners) {
844
- return this;
845
- }
846
- if (listener) {
847
- const listeners = this._anyOutgoingListeners;
848
- for (let i = 0; i < listeners.length; i++) {
849
- if (listener === listeners[i]) {
850
- listeners.splice(i, 1);
851
- return this;
852
- }
853
- }
854
- }
855
- else {
856
- this._anyOutgoingListeners = [];
857
- }
858
- return this;
859
- }
860
- /**
861
- * Returns an array of listeners that are listening for any event that is specified. This array can be manipulated,
862
- * e.g. to remove listeners.
863
- */
864
- listenersAnyOutgoing() {
865
- return this._anyOutgoingListeners || [];
866
- }
867
- /**
868
- * Notify the listeners for each packet sent
869
- *
870
- * @param packet
871
- *
872
- * @private
873
- */
874
- notifyOutgoingListeners(packet) {
875
- if (this._anyOutgoingListeners && this._anyOutgoingListeners.length) {
876
- const listeners = this._anyOutgoingListeners.slice();
877
- for (const listener of listeners) {
878
- listener.apply(this, packet.data);
879
- }
880
- }
881
- }
882
- }
883
-
884
- export { Socket };