@wabot-dev/framework 0.0.14 → 0.0.17
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.
- package/dist/src/ai/deepseek/DeepSeekChatBotAdapter.js +108 -0
- package/dist/src/channels/cmd/@cmd.js +1 -1
- package/dist/src/channels/cmd/CmdChannel.js +1 -1
- package/dist/src/channels/socket-io/@socket.js +24 -0
- package/dist/src/channels/socket-io/SocketChannel.js +78 -0
- package/dist/src/channels/socket-io/SocketChannelConfig.js +15 -0
- package/dist/src/channels/telegram/@telegram.js +1 -1
- package/dist/src/channels/telegram/TelegramChannel.js +1 -1
- package/dist/src/channels/whatsapp/@whatsapp.js +1 -1
- package/dist/src/channels/whatsapp/WhatsAppChannel.js +1 -1
- package/dist/src/channels/whatsapp/WhatsAppConnection.js +1 -1
- package/dist/src/channels/whatsapp/WhatsAppDevConnection.js +11 -3
- package/dist/src/channels/whatsapp/{whatsAppDevSocketContracts.js → WhatsAppDevSocketContracts.js} +1 -0
- package/dist/src/channels/whatsapp/WhatsAppProdConnection.js +4 -1
- package/dist/src/channels/whatsapp/WhatsAppSender.js +23 -0
- package/dist/src/controller/socket.io/SocketIO.js +1 -1
- package/dist/src/index.d.ts +82 -9
- package/dist/src/index.js +9 -1
- package/dist/src/logger/Logger.js +1 -1
- package/dist/src/mindset/MindsetOperator.js +1 -1
- package/dist/src/server/runChannel.js +1 -1
- package/dist/src/server/runServer.js +4 -4
- package/package.json +2 -1
- package/dist/src/_virtual/XMLHttpRequest.js +0 -7
- package/dist/src/_virtual/_commonjsHelpers.js +0 -32
- package/dist/src/_virtual/base64id.js +0 -3
- package/dist/src/_virtual/binary.js +0 -3
- package/dist/src/_virtual/bom-handling.js +0 -3
- package/dist/src/_virtual/broadcast-operator.js +0 -3
- package/dist/src/_virtual/browser.js +0 -3
- package/dist/src/_virtual/browser2.js +0 -3
- package/dist/src/_virtual/browser3.js +0 -3
- package/dist/src/_virtual/browser4.js +0 -3
- package/dist/src/_virtual/browser5.js +0 -3
- package/dist/src/_virtual/buffer-util.js +0 -3
- package/dist/src/_virtual/buffer-util2.js +0 -3
- package/dist/src/_virtual/buffer-util3.js +0 -3
- package/dist/src/_virtual/charset.js +0 -3
- package/dist/src/_virtual/charset2.js +0 -3
- package/dist/src/_virtual/client.js +0 -3
- package/dist/src/_virtual/cluster-adapter.js +0 -3
- package/dist/src/_virtual/commons.js +0 -3
- package/dist/src/_virtual/dbcs-codec.js +0 -3
- package/dist/src/_virtual/decodePacket.js +0 -3
- package/dist/src/_virtual/encodePacket.js +0 -3
- package/dist/src/_virtual/encoding.js +0 -3
- package/dist/src/_virtual/encoding2.js +0 -3
- package/dist/src/_virtual/engine.io.js +0 -3
- package/dist/src/_virtual/in-memory-adapter.js +0 -3
- package/dist/src/_virtual/index.js +0 -7
- package/dist/src/_virtual/index10.js +0 -3
- package/dist/src/_virtual/index11.js +0 -3
- package/dist/src/_virtual/index12.js +0 -3
- package/dist/src/_virtual/index13.js +0 -3
- package/dist/src/_virtual/index14.js +0 -3
- package/dist/src/_virtual/index15.js +0 -3
- package/dist/src/_virtual/index16.js +0 -3
- package/dist/src/_virtual/index17.js +0 -3
- package/dist/src/_virtual/index18.js +0 -3
- package/dist/src/_virtual/index19.js +0 -3
- package/dist/src/_virtual/index2.js +0 -7
- package/dist/src/_virtual/index20.js +0 -3
- package/dist/src/_virtual/index21.js +0 -3
- package/dist/src/_virtual/index22.js +0 -3
- package/dist/src/_virtual/index23.js +0 -3
- package/dist/src/_virtual/index24.js +0 -3
- package/dist/src/_virtual/index25.js +0 -3
- package/dist/src/_virtual/index26.js +0 -3
- package/dist/src/_virtual/index27.js +0 -3
- package/dist/src/_virtual/index28.js +0 -3
- package/dist/src/_virtual/index29.js +0 -3
- package/dist/src/_virtual/index3.js +0 -7
- package/dist/src/_virtual/index30.js +0 -3
- package/dist/src/_virtual/index31.js +0 -3
- package/dist/src/_virtual/index32.js +0 -3
- package/dist/src/_virtual/index33.js +0 -3
- package/dist/src/_virtual/index4.js +0 -3
- package/dist/src/_virtual/index5.js +0 -3
- package/dist/src/_virtual/index6.js +0 -3
- package/dist/src/_virtual/index7.js +0 -3
- package/dist/src/_virtual/index8.js +0 -6
- package/dist/src/_virtual/index9.js +0 -3
- package/dist/src/_virtual/inherits.js +0 -3
- package/dist/src/_virtual/inherits_browser.js +0 -3
- package/dist/src/_virtual/is-binary.js +0 -3
- package/dist/src/_virtual/language.js +0 -3
- package/dist/src/_virtual/language2.js +0 -3
- package/dist/src/_virtual/mediaType.js +0 -3
- package/dist/src/_virtual/mediaType2.js +0 -3
- package/dist/src/_virtual/namespace.js +0 -3
- package/dist/src/_virtual/node.js +0 -3
- package/dist/src/_virtual/node2.js +0 -3
- package/dist/src/_virtual/node3.js +0 -3
- package/dist/src/_virtual/node4.js +0 -3
- package/dist/src/_virtual/node5.js +0 -3
- package/dist/src/_virtual/parent-namespace.js +0 -3
- package/dist/src/_virtual/polling-jsonp.js +0 -3
- package/dist/src/_virtual/polling.js +0 -3
- package/dist/src/_virtual/polling2.js +0 -3
- package/dist/src/_virtual/receiver.js +0 -3
- package/dist/src/_virtual/sbcs-codec.js +0 -3
- package/dist/src/_virtual/sender.js +0 -3
- package/dist/src/_virtual/server.js +0 -3
- package/dist/src/_virtual/socket-types.js +0 -3
- package/dist/src/_virtual/socket.js +0 -3
- package/dist/src/_virtual/socket2.js +0 -3
- package/dist/src/_virtual/stream.js +0 -3
- package/dist/src/_virtual/transport.js +0 -3
- package/dist/src/_virtual/typed-events.js +0 -3
- package/dist/src/_virtual/userver.js +0 -3
- package/dist/src/_virtual/utf16.js +0 -3
- package/dist/src/_virtual/utf32.js +0 -3
- package/dist/src/_virtual/utf7.js +0 -3
- package/dist/src/_virtual/uws.js +0 -3
- package/dist/src/_virtual/validation.js +0 -3
- package/dist/src/_virtual/validation2.js +0 -3
- package/dist/src/_virtual/validation3.js +0 -3
- package/dist/src/_virtual/websocket-server.js +0 -3
- package/dist/src/_virtual/websocket.js +0 -7
- package/dist/src/_virtual/websocket2.js +0 -3
- package/dist/src/_virtual/websocket3.js +0 -3
- package/dist/src/_virtual/webtransport.js +0 -3
- package/dist/src/_virtual/yeast.js +0 -3
- package/dist/src/node_modules/@socket.io/component-emitter/lib/esm/index.js +0 -171
- package/dist/src/node_modules/base64id/lib/base64id.js +0 -117
- package/dist/src/node_modules/body-parser/index.js +0 -96
- package/dist/src/node_modules/body-parser/lib/read.js +0 -225
- package/dist/src/node_modules/body-parser/lib/types/json.js +0 -222
- package/dist/src/node_modules/body-parser/lib/types/raw.js +0 -90
- package/dist/src/node_modules/body-parser/lib/types/text.js +0 -95
- package/dist/src/node_modules/body-parser/lib/types/urlencoded.js +0 -194
- package/dist/src/node_modules/body-parser/lib/utils.js +0 -96
- package/dist/src/node_modules/bytes/index.js +0 -180
- package/dist/src/node_modules/call-bind-apply-helpers/actualApply.js +0 -24
- package/dist/src/node_modules/call-bind-apply-helpers/functionApply.js +0 -13
- package/dist/src/node_modules/call-bind-apply-helpers/functionCall.js +0 -13
- package/dist/src/node_modules/call-bind-apply-helpers/index.js +0 -29
- package/dist/src/node_modules/call-bind-apply-helpers/reflectApply.js +0 -13
- package/dist/src/node_modules/call-bound/index.js +0 -31
- package/dist/src/node_modules/content-type/index.js +0 -235
- package/dist/src/node_modules/cookie/index.js +0 -345
- package/dist/src/node_modules/cors/lib/index.js +0 -249
- package/dist/src/node_modules/debug/src/browser.js +0 -286
- package/dist/src/node_modules/debug/src/common.js +0 -303
- package/dist/src/node_modules/debug/src/index.js +0 -23
- package/dist/src/node_modules/debug/src/node.js +0 -279
- package/dist/src/node_modules/depd/index.js +0 -550
- package/dist/src/node_modules/dunder-proto/get.js +0 -42
- package/dist/src/node_modules/ee-first/index.js +0 -104
- package/dist/src/node_modules/engine.io/build/engine.io.js +0 -73
- package/dist/src/node_modules/engine.io/build/parser-v3/index.js +0 -429
- package/dist/src/node_modules/engine.io/build/parser-v3/utf8.js +0 -198
- package/dist/src/node_modules/engine.io/build/server.js +0 -808
- package/dist/src/node_modules/engine.io/build/socket.js +0 -469
- package/dist/src/node_modules/engine.io/build/transport.js +0 -131
- package/dist/src/node_modules/engine.io/build/transports/index.js +0 -37
- package/dist/src/node_modules/engine.io/build/transports/polling-jsonp.js +0 -53
- package/dist/src/node_modules/engine.io/build/transports/polling.js +0 -346
- package/dist/src/node_modules/engine.io/build/transports/websocket.js +0 -106
- package/dist/src/node_modules/engine.io/build/transports/webtransport.js +0 -76
- package/dist/src/node_modules/engine.io/build/transports-uws/index.js +0 -20
- package/dist/src/node_modules/engine.io/build/transports-uws/polling.js +0 -378
- package/dist/src/node_modules/engine.io/build/transports-uws/websocket.js +0 -85
- package/dist/src/node_modules/engine.io/build/userver.js +0 -292
- package/dist/src/node_modules/engine.io/node_modules/accepts/index.js +0 -250
- package/dist/src/node_modules/engine.io/node_modules/debug/src/browser.js +0 -285
- package/dist/src/node_modules/engine.io/node_modules/debug/src/common.js +0 -285
- package/dist/src/node_modules/engine.io/node_modules/debug/src/index.js +0 -23
- package/dist/src/node_modules/engine.io/node_modules/debug/src/node.js +0 -279
- package/dist/src/node_modules/engine.io/node_modules/mime-db/db.json.js +0 -10704
- package/dist/src/node_modules/engine.io/node_modules/mime-db/index.js +0 -24
- package/dist/src/node_modules/engine.io/node_modules/mime-types/index.js +0 -202
- package/dist/src/node_modules/engine.io/node_modules/negotiator/index.js +0 -96
- package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/charset.js +0 -179
- package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/encoding.js +0 -193
- package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/language.js +0 -188
- package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/mediaType.js +0 -304
- package/dist/src/node_modules/engine.io/node_modules/ws/index.js +0 -28
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/buffer-util.js +0 -142
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/constants.js +0 -21
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/event-target.js +0 -303
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/extension.js +0 -214
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/limiter.js +0 -64
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/permessage-deflate.js +0 -528
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/receiver.js +0 -719
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/sender.js +0 -513
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/stream.js +0 -170
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/subprotocol.js +0 -73
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/validation.js +0 -141
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket-server.js +0 -559
- package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket.js +0 -1363
- package/dist/src/node_modules/engine.io-client/build/esm/contrib/has-cors.js +0 -13
- package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseqs.js +0 -36
- package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseuri.js +0 -66
- package/dist/src/node_modules/engine.io-client/build/esm/globals.node.js +0 -92
- package/dist/src/node_modules/engine.io-client/build/esm/index.js +0 -17
- package/dist/src/node_modules/engine.io-client/build/esm/socket.js +0 -728
- package/dist/src/node_modules/engine.io-client/build/esm/transport.js +0 -143
- package/dist/src/node_modules/engine.io-client/build/esm/transports/index.js +0 -11
- package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +0 -256
- package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.js +0 -21
- package/dist/src/node_modules/engine.io-client/build/esm/transports/polling.js +0 -146
- package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.js +0 -107
- package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.node.js +0 -48
- package/dist/src/node_modules/engine.io-client/build/esm/transports/webtransport.js +0 -83
- package/dist/src/node_modules/engine.io-client/build/esm/util.js +0 -62
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js +0 -142
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/constants.js +0 -21
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/event-target.js +0 -303
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/extension.js +0 -214
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/limiter.js +0 -64
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js +0 -528
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/receiver.js +0 -719
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/sender.js +0 -513
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/stream.js +0 -170
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/subprotocol.js +0 -73
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/validation.js +0 -141
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket-server.js +0 -559
- package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket.js +0 -1363
- package/dist/src/node_modules/engine.io-parser/build/cjs/commons.js +0 -29
- package/dist/src/node_modules/engine.io-parser/build/cjs/decodePacket.js +0 -70
- package/dist/src/node_modules/engine.io-parser/build/cjs/encodePacket.js +0 -51
- package/dist/src/node_modules/engine.io-parser/build/cjs/index.js +0 -179
- package/dist/src/node_modules/engine.io-parser/build/esm/commons.js +0 -15
- package/dist/src/node_modules/engine.io-parser/build/esm/decodePacket.js +0 -58
- package/dist/src/node_modules/engine.io-parser/build/esm/encodePacket.js +0 -36
- package/dist/src/node_modules/engine.io-parser/build/esm/index.js +0 -158
- package/dist/src/node_modules/es-define-property/index.js +0 -23
- package/dist/src/node_modules/es-errors/eval.js +0 -13
- package/dist/src/node_modules/es-errors/index.js +0 -13
- package/dist/src/node_modules/es-errors/range.js +0 -13
- package/dist/src/node_modules/es-errors/ref.js +0 -13
- package/dist/src/node_modules/es-errors/syntax.js +0 -13
- package/dist/src/node_modules/es-errors/type.js +0 -13
- package/dist/src/node_modules/es-errors/uri.js +0 -13
- package/dist/src/node_modules/es-object-atoms/index.js +0 -13
- package/dist/src/node_modules/function-bind/implementation.js +0 -93
- package/dist/src/node_modules/function-bind/index.js +0 -16
- package/dist/src/node_modules/get-intrinsic/index.js +0 -413
- package/dist/src/node_modules/get-proto/Object.getPrototypeOf.js +0 -17
- package/dist/src/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -13
- package/dist/src/node_modules/get-proto/index.js +0 -40
- package/dist/src/node_modules/gopd/gOPD.js +0 -13
- package/dist/src/node_modules/gopd/index.js +0 -26
- package/dist/src/node_modules/has-symbols/index.js +0 -25
- package/dist/src/node_modules/has-symbols/shams.js +0 -54
- package/dist/src/node_modules/hasown/index.js +0 -19
- package/dist/src/node_modules/http-errors/index.js +0 -306
- package/dist/src/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -598
- package/dist/src/node_modules/iconv-lite/encodings/dbcs-data.js +0 -206
- package/dist/src/node_modules/iconv-lite/encodings/index.js +0 -44
- package/dist/src/node_modules/iconv-lite/encodings/internal.js +0 -210
- package/dist/src/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -83
- package/dist/src/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -460
- package/dist/src/node_modules/iconv-lite/encodings/sbcs-data.js +0 -187
- package/dist/src/node_modules/iconv-lite/encodings/tables/big5-added.json.js +0 -506
- package/dist/src/node_modules/iconv-lite/encodings/tables/cp936.json.js +0 -2621
- package/dist/src/node_modules/iconv-lite/encodings/tables/cp949.json.js +0 -2380
- package/dist/src/node_modules/iconv-lite/encodings/tables/cp950.json.js +0 -729
- package/dist/src/node_modules/iconv-lite/encodings/tables/eucjp.json.js +0 -822
- package/dist/src/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json.js +0 -424
- package/dist/src/node_modules/iconv-lite/encodings/tables/gbk-added.json.js +0 -264
- package/dist/src/node_modules/iconv-lite/encodings/tables/shiftjis.json.js +0 -548
- package/dist/src/node_modules/iconv-lite/encodings/utf16.js +0 -206
- package/dist/src/node_modules/iconv-lite/encodings/utf32.js +0 -329
- package/dist/src/node_modules/iconv-lite/encodings/utf7.js +0 -297
- package/dist/src/node_modules/iconv-lite/lib/bom-handling.js +0 -61
- package/dist/src/node_modules/iconv-lite/lib/index.js +0 -192
- package/dist/src/node_modules/iconv-lite/lib/streams.js +0 -120
- package/dist/src/node_modules/inherits/inherits.js +0 -21
- package/dist/src/node_modules/inherits/inherits_browser.js +0 -38
- package/dist/src/node_modules/math-intrinsics/abs.js +0 -13
- package/dist/src/node_modules/math-intrinsics/floor.js +0 -13
- package/dist/src/node_modules/math-intrinsics/isNaN.js +0 -15
- package/dist/src/node_modules/math-intrinsics/max.js +0 -13
- package/dist/src/node_modules/math-intrinsics/min.js +0 -13
- package/dist/src/node_modules/math-intrinsics/pow.js +0 -13
- package/dist/src/node_modules/math-intrinsics/round.js +0 -13
- package/dist/src/node_modules/math-intrinsics/sign.js +0 -22
- package/dist/src/node_modules/media-typer/index.js +0 -153
- package/dist/src/node_modules/mime-db/db.json.js +0 -11656
- package/dist/src/node_modules/mime-db/index.js +0 -24
- package/dist/src/node_modules/mime-types/index.js +0 -226
- package/dist/src/node_modules/mime-types/mimeScore.js +0 -62
- package/dist/src/node_modules/ms/index.js +0 -172
- package/dist/src/node_modules/object-assign/index.js +0 -99
- package/dist/src/node_modules/object-inspect/index.js +0 -557
- package/dist/src/node_modules/object-inspect/util.inspect.js +0 -13
- package/dist/src/node_modules/on-finished/index.js +0 -245
- package/dist/src/node_modules/qs/lib/formats.js +0 -32
- package/dist/src/node_modules/qs/lib/index.js +0 -24
- package/dist/src/node_modules/qs/lib/parse.js +0 -339
- package/dist/src/node_modules/qs/lib/stringify.js +0 -369
- package/dist/src/node_modules/qs/lib/utils.js +0 -279
- package/dist/src/node_modules/raw-body/index.js +0 -351
- package/dist/src/node_modules/safer-buffer/safer.js +0 -88
- package/dist/src/node_modules/setprototypeof/index.js +0 -26
- package/dist/src/node_modules/side-channel/index.js +0 -58
- package/dist/src/node_modules/side-channel-list/index.js +0 -125
- package/dist/src/node_modules/side-channel-map/index.js +0 -82
- package/dist/src/node_modules/side-channel-weakmap/index.js +0 -99
- package/dist/src/node_modules/socket.io/dist/broadcast-operator.js +0 -448
- package/dist/src/node_modules/socket.io/dist/client.js +0 -281
- package/dist/src/node_modules/socket.io/dist/index.js +0 -837
- package/dist/src/node_modules/socket.io/dist/namespace.js +0 -597
- package/dist/src/node_modules/socket.io/dist/parent-namespace.js +0 -101
- package/dist/src/node_modules/socket.io/dist/socket-types.js +0 -21
- package/dist/src/node_modules/socket.io/dist/socket.js +0 -993
- package/dist/src/node_modules/socket.io/dist/typed-events.js +0 -92
- package/dist/src/node_modules/socket.io/dist/uws.js +0 -149
- package/dist/src/node_modules/socket.io/node_modules/accepts/index.js +0 -250
- package/dist/src/node_modules/socket.io/node_modules/debug/src/browser.js +0 -285
- package/dist/src/node_modules/socket.io/node_modules/debug/src/common.js +0 -285
- package/dist/src/node_modules/socket.io/node_modules/debug/src/index.js +0 -23
- package/dist/src/node_modules/socket.io/node_modules/debug/src/node.js +0 -279
- package/dist/src/node_modules/socket.io/node_modules/mime-db/db.json.js +0 -10704
- package/dist/src/node_modules/socket.io/node_modules/mime-db/index.js +0 -24
- package/dist/src/node_modules/socket.io/node_modules/mime-types/index.js +0 -202
- package/dist/src/node_modules/socket.io/node_modules/negotiator/index.js +0 -96
- package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/charset.js +0 -179
- package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/encoding.js +0 -193
- package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/language.js +0 -188
- package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/mediaType.js +0 -304
- package/dist/src/node_modules/socket.io/package.json.js +0 -5
- package/dist/src/node_modules/socket.io/wrapper.js +0 -5
- package/dist/src/node_modules/socket.io-adapter/dist/cluster-adapter.js +0 -689
- package/dist/src/node_modules/socket.io-adapter/dist/contrib/yeast.js +0 -64
- package/dist/src/node_modules/socket.io-adapter/dist/in-memory-adapter.js +0 -407
- package/dist/src/node_modules/socket.io-adapter/dist/index.js +0 -24
- package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/browser.js +0 -285
- package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/common.js +0 -285
- package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/index.js +0 -23
- package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/node.js +0 -279
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/index.js +0 -28
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/buffer-util.js +0 -142
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/constants.js +0 -21
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/event-target.js +0 -303
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/extension.js +0 -214
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/limiter.js +0 -64
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/permessage-deflate.js +0 -528
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/receiver.js +0 -719
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/sender.js +0 -513
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/stream.js +0 -170
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/subprotocol.js +0 -73
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/validation.js +0 -141
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket-server.js +0 -559
- package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket.js +0 -1363
- package/dist/src/node_modules/socket.io-client/build/esm/contrib/backo2.js +0 -68
- package/dist/src/node_modules/socket.io-client/build/esm/index.js +0 -50
- package/dist/src/node_modules/socket.io-client/build/esm/manager.js +0 -373
- package/dist/src/node_modules/socket.io-client/build/esm/on.js +0 -8
- package/dist/src/node_modules/socket.io-client/build/esm/socket.js +0 -884
- package/dist/src/node_modules/socket.io-client/build/esm/url.js +0 -63
- package/dist/src/node_modules/socket.io-parser/build/cjs/binary.js +0 -99
- package/dist/src/node_modules/socket.io-parser/build/cjs/index.js +0 -337
- package/dist/src/node_modules/socket.io-parser/build/cjs/is-binary.js +0 -65
- package/dist/src/node_modules/socket.io-parser/build/esm/binary.js +0 -86
- package/dist/src/node_modules/socket.io-parser/build/esm/index.js +0 -314
- package/dist/src/node_modules/socket.io-parser/build/esm/is-binary.js +0 -52
- package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/browser.js +0 -285
- package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/common.js +0 -285
- package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/index.js +0 -23
- package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/node.js +0 -279
- package/dist/src/node_modules/statuses/codes.json.js +0 -67
- package/dist/src/node_modules/statuses/index.js +0 -157
- package/dist/src/node_modules/toidentifier/index.js +0 -41
- package/dist/src/node_modules/type-is/index.js +0 -263
- package/dist/src/node_modules/unpipe/index.js +0 -78
- package/dist/src/node_modules/vary/index.js +0 -159
- package/dist/src/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js +0 -702
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Initialize backoff timer with `opts`.
|
|
3
|
-
*
|
|
4
|
-
* - `min` initial timeout in milliseconds [100]
|
|
5
|
-
* - `max` max timeout [10000]
|
|
6
|
-
* - `jitter` [0]
|
|
7
|
-
* - `factor` [2]
|
|
8
|
-
*
|
|
9
|
-
* @param {Object} opts
|
|
10
|
-
* @api public
|
|
11
|
-
*/
|
|
12
|
-
function Backoff(opts) {
|
|
13
|
-
opts = opts || {};
|
|
14
|
-
this.ms = opts.min || 100;
|
|
15
|
-
this.max = opts.max || 10000;
|
|
16
|
-
this.factor = opts.factor || 2;
|
|
17
|
-
this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;
|
|
18
|
-
this.attempts = 0;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Return the backoff duration.
|
|
22
|
-
*
|
|
23
|
-
* @return {Number}
|
|
24
|
-
* @api public
|
|
25
|
-
*/
|
|
26
|
-
Backoff.prototype.duration = function () {
|
|
27
|
-
var ms = this.ms * Math.pow(this.factor, this.attempts++);
|
|
28
|
-
if (this.jitter) {
|
|
29
|
-
var rand = Math.random();
|
|
30
|
-
var deviation = Math.floor(rand * this.jitter * ms);
|
|
31
|
-
ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;
|
|
32
|
-
}
|
|
33
|
-
return Math.min(ms, this.max) | 0;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Reset the number of attempts.
|
|
37
|
-
*
|
|
38
|
-
* @api public
|
|
39
|
-
*/
|
|
40
|
-
Backoff.prototype.reset = function () {
|
|
41
|
-
this.attempts = 0;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Set the minimum duration
|
|
45
|
-
*
|
|
46
|
-
* @api public
|
|
47
|
-
*/
|
|
48
|
-
Backoff.prototype.setMin = function (min) {
|
|
49
|
-
this.ms = min;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Set the maximum duration
|
|
53
|
-
*
|
|
54
|
-
* @api public
|
|
55
|
-
*/
|
|
56
|
-
Backoff.prototype.setMax = function (max) {
|
|
57
|
-
this.max = max;
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Set the jitter
|
|
61
|
-
*
|
|
62
|
-
* @api public
|
|
63
|
-
*/
|
|
64
|
-
Backoff.prototype.setJitter = function (jitter) {
|
|
65
|
-
this.jitter = jitter;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export { Backoff };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { url } from './url.js';
|
|
2
|
-
import { Manager } from './manager.js';
|
|
3
|
-
import { Socket } from './socket.js';
|
|
4
|
-
export { protocol } from '../../../socket.io-parser/build/esm/index.js';
|
|
5
|
-
import '../../../engine.io-client/build/esm/index.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Managers cache.
|
|
9
|
-
*/
|
|
10
|
-
const cache = {};
|
|
11
|
-
function lookup(uri, opts) {
|
|
12
|
-
if (typeof uri === "object") {
|
|
13
|
-
opts = uri;
|
|
14
|
-
uri = undefined;
|
|
15
|
-
}
|
|
16
|
-
opts = opts || {};
|
|
17
|
-
const parsed = url(uri, opts.path || "/socket.io");
|
|
18
|
-
const source = parsed.source;
|
|
19
|
-
const id = parsed.id;
|
|
20
|
-
const path = parsed.path;
|
|
21
|
-
const sameNamespace = cache[id] && path in cache[id]["nsps"];
|
|
22
|
-
const newConnection = opts.forceNew ||
|
|
23
|
-
opts["force new connection"] ||
|
|
24
|
-
false === opts.multiplex ||
|
|
25
|
-
sameNamespace;
|
|
26
|
-
let io;
|
|
27
|
-
if (newConnection) {
|
|
28
|
-
io = new Manager(source, opts);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
if (!cache[id]) {
|
|
32
|
-
cache[id] = new Manager(source, opts);
|
|
33
|
-
}
|
|
34
|
-
io = cache[id];
|
|
35
|
-
}
|
|
36
|
-
if (parsed.query && !opts.query) {
|
|
37
|
-
opts.query = parsed.queryKey;
|
|
38
|
-
}
|
|
39
|
-
return io.socket(parsed.path, opts);
|
|
40
|
-
}
|
|
41
|
-
// so that "lookup" can be used both as a function (e.g. `io(...)`) and as a
|
|
42
|
-
// namespace (e.g. `io.connect(...)`), for backward compatibility
|
|
43
|
-
Object.assign(lookup, {
|
|
44
|
-
Manager,
|
|
45
|
-
Socket,
|
|
46
|
-
io: lookup,
|
|
47
|
-
connect: lookup,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
export { Manager, Socket, lookup as connect, lookup as default, lookup as io };
|
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
import '../../../engine.io-client/build/esm/index.js';
|
|
2
|
-
import { Socket as Socket$1 } from './socket.js';
|
|
3
|
-
import * as index from '../../../socket.io-parser/build/esm/index.js';
|
|
4
|
-
import { on } from './on.js';
|
|
5
|
-
import { Backoff } from './contrib/backo2.js';
|
|
6
|
-
import { Emitter } from '../../../@socket.io/component-emitter/lib/esm/index.js';
|
|
7
|
-
import { installTimerFunctions } from '../../../engine.io-client/build/esm/util.js';
|
|
8
|
-
import { Socket } from '../../../engine.io-client/build/esm/socket.js';
|
|
9
|
-
import { nextTick } from '../../../engine.io-client/build/esm/globals.node.js';
|
|
10
|
-
|
|
11
|
-
class Manager extends Emitter {
|
|
12
|
-
constructor(uri, opts) {
|
|
13
|
-
var _a;
|
|
14
|
-
super();
|
|
15
|
-
this.nsps = {};
|
|
16
|
-
this.subs = [];
|
|
17
|
-
if (uri && "object" === typeof uri) {
|
|
18
|
-
opts = uri;
|
|
19
|
-
uri = undefined;
|
|
20
|
-
}
|
|
21
|
-
opts = opts || {};
|
|
22
|
-
opts.path = opts.path || "/socket.io";
|
|
23
|
-
this.opts = opts;
|
|
24
|
-
installTimerFunctions(this, opts);
|
|
25
|
-
this.reconnection(opts.reconnection !== false);
|
|
26
|
-
this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
|
|
27
|
-
this.reconnectionDelay(opts.reconnectionDelay || 1000);
|
|
28
|
-
this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);
|
|
29
|
-
this.randomizationFactor((_a = opts.randomizationFactor) !== null && _a !== void 0 ? _a : 0.5);
|
|
30
|
-
this.backoff = new Backoff({
|
|
31
|
-
min: this.reconnectionDelay(),
|
|
32
|
-
max: this.reconnectionDelayMax(),
|
|
33
|
-
jitter: this.randomizationFactor(),
|
|
34
|
-
});
|
|
35
|
-
this.timeout(null == opts.timeout ? 20000 : opts.timeout);
|
|
36
|
-
this._readyState = "closed";
|
|
37
|
-
this.uri = uri;
|
|
38
|
-
const _parser = opts.parser || index;
|
|
39
|
-
this.encoder = new _parser.Encoder();
|
|
40
|
-
this.decoder = new _parser.Decoder();
|
|
41
|
-
this._autoConnect = opts.autoConnect !== false;
|
|
42
|
-
if (this._autoConnect)
|
|
43
|
-
this.open();
|
|
44
|
-
}
|
|
45
|
-
reconnection(v) {
|
|
46
|
-
if (!arguments.length)
|
|
47
|
-
return this._reconnection;
|
|
48
|
-
this._reconnection = !!v;
|
|
49
|
-
if (!v) {
|
|
50
|
-
this.skipReconnect = true;
|
|
51
|
-
}
|
|
52
|
-
return this;
|
|
53
|
-
}
|
|
54
|
-
reconnectionAttempts(v) {
|
|
55
|
-
if (v === undefined)
|
|
56
|
-
return this._reconnectionAttempts;
|
|
57
|
-
this._reconnectionAttempts = v;
|
|
58
|
-
return this;
|
|
59
|
-
}
|
|
60
|
-
reconnectionDelay(v) {
|
|
61
|
-
var _a;
|
|
62
|
-
if (v === undefined)
|
|
63
|
-
return this._reconnectionDelay;
|
|
64
|
-
this._reconnectionDelay = v;
|
|
65
|
-
(_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setMin(v);
|
|
66
|
-
return this;
|
|
67
|
-
}
|
|
68
|
-
randomizationFactor(v) {
|
|
69
|
-
var _a;
|
|
70
|
-
if (v === undefined)
|
|
71
|
-
return this._randomizationFactor;
|
|
72
|
-
this._randomizationFactor = v;
|
|
73
|
-
(_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setJitter(v);
|
|
74
|
-
return this;
|
|
75
|
-
}
|
|
76
|
-
reconnectionDelayMax(v) {
|
|
77
|
-
var _a;
|
|
78
|
-
if (v === undefined)
|
|
79
|
-
return this._reconnectionDelayMax;
|
|
80
|
-
this._reconnectionDelayMax = v;
|
|
81
|
-
(_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setMax(v);
|
|
82
|
-
return this;
|
|
83
|
-
}
|
|
84
|
-
timeout(v) {
|
|
85
|
-
if (!arguments.length)
|
|
86
|
-
return this._timeout;
|
|
87
|
-
this._timeout = v;
|
|
88
|
-
return this;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Starts trying to reconnect if reconnection is enabled and we have not
|
|
92
|
-
* started reconnecting yet
|
|
93
|
-
*
|
|
94
|
-
* @private
|
|
95
|
-
*/
|
|
96
|
-
maybeReconnectOnOpen() {
|
|
97
|
-
// Only try to reconnect if it's the first time we're connecting
|
|
98
|
-
if (!this._reconnecting &&
|
|
99
|
-
this._reconnection &&
|
|
100
|
-
this.backoff.attempts === 0) {
|
|
101
|
-
// keeps reconnection from firing twice for the same reconnection loop
|
|
102
|
-
this.reconnect();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Sets the current transport `socket`.
|
|
107
|
-
*
|
|
108
|
-
* @param {Function} fn - optional, callback
|
|
109
|
-
* @return self
|
|
110
|
-
* @public
|
|
111
|
-
*/
|
|
112
|
-
open(fn) {
|
|
113
|
-
if (~this._readyState.indexOf("open"))
|
|
114
|
-
return this;
|
|
115
|
-
this.engine = new Socket(this.uri, this.opts);
|
|
116
|
-
const socket = this.engine;
|
|
117
|
-
const self = this;
|
|
118
|
-
this._readyState = "opening";
|
|
119
|
-
this.skipReconnect = false;
|
|
120
|
-
// emit `open`
|
|
121
|
-
const openSubDestroy = on(socket, "open", function () {
|
|
122
|
-
self.onopen();
|
|
123
|
-
fn && fn();
|
|
124
|
-
});
|
|
125
|
-
const onError = (err) => {
|
|
126
|
-
this.cleanup();
|
|
127
|
-
this._readyState = "closed";
|
|
128
|
-
this.emitReserved("error", err);
|
|
129
|
-
if (fn) {
|
|
130
|
-
fn(err);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
// Only do this if there is no fn to handle the error
|
|
134
|
-
this.maybeReconnectOnOpen();
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
// emit `error`
|
|
138
|
-
const errorSub = on(socket, "error", onError);
|
|
139
|
-
if (false !== this._timeout) {
|
|
140
|
-
const timeout = this._timeout;
|
|
141
|
-
// set timer
|
|
142
|
-
const timer = this.setTimeoutFn(() => {
|
|
143
|
-
openSubDestroy();
|
|
144
|
-
onError(new Error("timeout"));
|
|
145
|
-
socket.close();
|
|
146
|
-
}, timeout);
|
|
147
|
-
if (this.opts.autoUnref) {
|
|
148
|
-
timer.unref();
|
|
149
|
-
}
|
|
150
|
-
this.subs.push(() => {
|
|
151
|
-
this.clearTimeoutFn(timer);
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
this.subs.push(openSubDestroy);
|
|
155
|
-
this.subs.push(errorSub);
|
|
156
|
-
return this;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Alias for open()
|
|
160
|
-
*
|
|
161
|
-
* @return self
|
|
162
|
-
* @public
|
|
163
|
-
*/
|
|
164
|
-
connect(fn) {
|
|
165
|
-
return this.open(fn);
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Called upon transport open.
|
|
169
|
-
*
|
|
170
|
-
* @private
|
|
171
|
-
*/
|
|
172
|
-
onopen() {
|
|
173
|
-
// clear old subs
|
|
174
|
-
this.cleanup();
|
|
175
|
-
// mark as open
|
|
176
|
-
this._readyState = "open";
|
|
177
|
-
this.emitReserved("open");
|
|
178
|
-
// add new subs
|
|
179
|
-
const socket = this.engine;
|
|
180
|
-
this.subs.push(on(socket, "ping", this.onping.bind(this)), on(socket, "data", this.ondata.bind(this)), on(socket, "error", this.onerror.bind(this)), on(socket, "close", this.onclose.bind(this)),
|
|
181
|
-
// @ts-ignore
|
|
182
|
-
on(this.decoder, "decoded", this.ondecoded.bind(this)));
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Called upon a ping.
|
|
186
|
-
*
|
|
187
|
-
* @private
|
|
188
|
-
*/
|
|
189
|
-
onping() {
|
|
190
|
-
this.emitReserved("ping");
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Called with data.
|
|
194
|
-
*
|
|
195
|
-
* @private
|
|
196
|
-
*/
|
|
197
|
-
ondata(data) {
|
|
198
|
-
try {
|
|
199
|
-
this.decoder.add(data);
|
|
200
|
-
}
|
|
201
|
-
catch (e) {
|
|
202
|
-
this.onclose("parse error", e);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Called when parser fully decodes a packet.
|
|
207
|
-
*
|
|
208
|
-
* @private
|
|
209
|
-
*/
|
|
210
|
-
ondecoded(packet) {
|
|
211
|
-
// the nextTick call prevents an exception in a user-provided event listener from triggering a disconnection due to a "parse error"
|
|
212
|
-
nextTick(() => {
|
|
213
|
-
this.emitReserved("packet", packet);
|
|
214
|
-
}, this.setTimeoutFn);
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Called upon socket error.
|
|
218
|
-
*
|
|
219
|
-
* @private
|
|
220
|
-
*/
|
|
221
|
-
onerror(err) {
|
|
222
|
-
this.emitReserved("error", err);
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Creates a new socket for the given `nsp`.
|
|
226
|
-
*
|
|
227
|
-
* @return {Socket}
|
|
228
|
-
* @public
|
|
229
|
-
*/
|
|
230
|
-
socket(nsp, opts) {
|
|
231
|
-
let socket = this.nsps[nsp];
|
|
232
|
-
if (!socket) {
|
|
233
|
-
socket = new Socket$1(this, nsp, opts);
|
|
234
|
-
this.nsps[nsp] = socket;
|
|
235
|
-
}
|
|
236
|
-
else if (this._autoConnect && !socket.active) {
|
|
237
|
-
socket.connect();
|
|
238
|
-
}
|
|
239
|
-
return socket;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Called upon a socket close.
|
|
243
|
-
*
|
|
244
|
-
* @param socket
|
|
245
|
-
* @private
|
|
246
|
-
*/
|
|
247
|
-
_destroy(socket) {
|
|
248
|
-
const nsps = Object.keys(this.nsps);
|
|
249
|
-
for (const nsp of nsps) {
|
|
250
|
-
const socket = this.nsps[nsp];
|
|
251
|
-
if (socket.active) {
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
this._close();
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Writes a packet.
|
|
259
|
-
*
|
|
260
|
-
* @param packet
|
|
261
|
-
* @private
|
|
262
|
-
*/
|
|
263
|
-
_packet(packet) {
|
|
264
|
-
const encodedPackets = this.encoder.encode(packet);
|
|
265
|
-
for (let i = 0; i < encodedPackets.length; i++) {
|
|
266
|
-
this.engine.write(encodedPackets[i], packet.options);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Clean up transport subscriptions and packet buffer.
|
|
271
|
-
*
|
|
272
|
-
* @private
|
|
273
|
-
*/
|
|
274
|
-
cleanup() {
|
|
275
|
-
this.subs.forEach((subDestroy) => subDestroy());
|
|
276
|
-
this.subs.length = 0;
|
|
277
|
-
this.decoder.destroy();
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Close the current socket.
|
|
281
|
-
*
|
|
282
|
-
* @private
|
|
283
|
-
*/
|
|
284
|
-
_close() {
|
|
285
|
-
this.skipReconnect = true;
|
|
286
|
-
this._reconnecting = false;
|
|
287
|
-
this.onclose("forced close");
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Alias for close()
|
|
291
|
-
*
|
|
292
|
-
* @private
|
|
293
|
-
*/
|
|
294
|
-
disconnect() {
|
|
295
|
-
return this._close();
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Called when:
|
|
299
|
-
*
|
|
300
|
-
* - the low-level engine is closed
|
|
301
|
-
* - the parser encountered a badly formatted packet
|
|
302
|
-
* - all sockets are disconnected
|
|
303
|
-
*
|
|
304
|
-
* @private
|
|
305
|
-
*/
|
|
306
|
-
onclose(reason, description) {
|
|
307
|
-
var _a;
|
|
308
|
-
this.cleanup();
|
|
309
|
-
(_a = this.engine) === null || _a === void 0 ? void 0 : _a.close();
|
|
310
|
-
this.backoff.reset();
|
|
311
|
-
this._readyState = "closed";
|
|
312
|
-
this.emitReserved("close", reason, description);
|
|
313
|
-
if (this._reconnection && !this.skipReconnect) {
|
|
314
|
-
this.reconnect();
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Attempt a reconnection.
|
|
319
|
-
*
|
|
320
|
-
* @private
|
|
321
|
-
*/
|
|
322
|
-
reconnect() {
|
|
323
|
-
if (this._reconnecting || this.skipReconnect)
|
|
324
|
-
return this;
|
|
325
|
-
const self = this;
|
|
326
|
-
if (this.backoff.attempts >= this._reconnectionAttempts) {
|
|
327
|
-
this.backoff.reset();
|
|
328
|
-
this.emitReserved("reconnect_failed");
|
|
329
|
-
this._reconnecting = false;
|
|
330
|
-
}
|
|
331
|
-
else {
|
|
332
|
-
const delay = this.backoff.duration();
|
|
333
|
-
this._reconnecting = true;
|
|
334
|
-
const timer = this.setTimeoutFn(() => {
|
|
335
|
-
if (self.skipReconnect)
|
|
336
|
-
return;
|
|
337
|
-
this.emitReserved("reconnect_attempt", self.backoff.attempts);
|
|
338
|
-
// check again for the case socket closed in above events
|
|
339
|
-
if (self.skipReconnect)
|
|
340
|
-
return;
|
|
341
|
-
self.open((err) => {
|
|
342
|
-
if (err) {
|
|
343
|
-
self._reconnecting = false;
|
|
344
|
-
self.reconnect();
|
|
345
|
-
this.emitReserved("reconnect_error", err);
|
|
346
|
-
}
|
|
347
|
-
else {
|
|
348
|
-
self.onreconnect();
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
}, delay);
|
|
352
|
-
if (this.opts.autoUnref) {
|
|
353
|
-
timer.unref();
|
|
354
|
-
}
|
|
355
|
-
this.subs.push(() => {
|
|
356
|
-
this.clearTimeoutFn(timer);
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Called upon successful reconnect.
|
|
362
|
-
*
|
|
363
|
-
* @private
|
|
364
|
-
*/
|
|
365
|
-
onreconnect() {
|
|
366
|
-
const attempt = this.backoff.attempts;
|
|
367
|
-
this._reconnecting = false;
|
|
368
|
-
this.backoff.reset();
|
|
369
|
-
this.emitReserved("reconnect", attempt);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
export { Manager };
|