@webex/calling 3.12.0-mobius-socket.19 → 3.12.0-mobius-socket.20
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/mobius-socket/errors.js +47 -6
- package/dist/mobius-socket/errors.js.map +1 -1
- package/dist/mobius-socket/index.js +4 -10
- package/dist/mobius-socket/index.js.map +1 -1
- package/dist/mobius-socket/mobius-socket.js +151 -140
- package/dist/mobius-socket/mobius-socket.js.map +1 -1
- package/dist/mobius-socket/mobius-socket.test.js +18 -11
- package/dist/mobius-socket/mobius-socket.test.js.map +1 -1
- package/dist/mobius-socket/socket/constants.js +14 -0
- package/dist/mobius-socket/socket/constants.js.map +1 -1
- package/dist/mobius-socket/socket/socket-base.js +93 -138
- package/dist/mobius-socket/socket/socket-base.js.map +1 -1
- package/dist/mobius-socket/socket/types.js.map +1 -1
- package/dist/mobius-socket/socket.test.js +3 -3
- package/dist/mobius-socket/socket.test.js.map +1 -1
- package/dist/mobius-socket/types.js.map +1 -1
- package/dist/module/mobius-socket/errors.js +17 -0
- package/dist/module/mobius-socket/mobius-socket.js +39 -41
- package/dist/module/mobius-socket/socket/socket-base.js +26 -58
- package/dist/types/mobius-socket/errors.d.ts +4 -1
- package/dist/types/mobius-socket/errors.d.ts.map +1 -1
- package/dist/types/mobius-socket/index.d.ts.map +1 -1
- package/dist/types/mobius-socket/mobius-socket.d.ts +14 -1
- package/dist/types/mobius-socket/mobius-socket.d.ts.map +1 -1
- package/dist/types/mobius-socket/socket/constants.d.ts.map +1 -1
- package/dist/types/mobius-socket/socket/socket-base.d.ts +0 -1
- package/dist/types/mobius-socket/socket/socket-base.d.ts.map +1 -1
- package/dist/types/mobius-socket/socket/types.d.ts +0 -8
- package/dist/types/mobius-socket/socket/types.d.ts.map +1 -1
- package/dist/types/mobius-socket/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,8 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.UnknownResponse = exports.NotAuthorized = exports.Forbidden = exports.ConnectionError = exports.BadRequest = void 0;
|
|
10
|
+
exports.createTimeoutError = createTimeoutError;
|
|
11
|
+
exports.createWssResponseError = createWssResponseError;
|
|
10
12
|
var _defineProperties = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/define-properties"));
|
|
11
13
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
12
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
@@ -20,7 +22,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
20
22
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
21
23
|
*/ // @ts-expect-error `@webex/common` is still JS-only and does not ship declarations.
|
|
22
24
|
/**
|
|
23
|
-
* Exception thrown when a websocket gets closed
|
|
25
|
+
* Exception thrown when a websocket gets closed.
|
|
24
26
|
*/
|
|
25
27
|
var ConnectionError = exports.ConnectionError = /*#__PURE__*/function (_Exception) {
|
|
26
28
|
// eslint-disable-next-line no-useless-constructor
|
|
@@ -34,7 +36,9 @@ var ConnectionError = exports.ConnectionError = /*#__PURE__*/function (_Exceptio
|
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
/**
|
|
37
|
-
*
|
|
39
|
+
* Parses a close event and sets the code and reason properties.
|
|
40
|
+
* @param event - Socket close event to parse
|
|
41
|
+
* @returns The reason string from the event
|
|
38
42
|
*/
|
|
39
43
|
(0, _inherits2.default)(ConnectionError, _Exception);
|
|
40
44
|
return (0, _createClass2.default)(ConnectionError, [{
|
|
@@ -54,7 +58,9 @@ var ConnectionError = exports.ConnectionError = /*#__PURE__*/function (_Exceptio
|
|
|
54
58
|
}]);
|
|
55
59
|
}(_common.Exception);
|
|
56
60
|
/**
|
|
57
|
-
*
|
|
61
|
+
* Thrown for CloseCode 1005.
|
|
62
|
+
* UnknownResponse is produced by IE when we receive a 4XXX close code.
|
|
63
|
+
* This should typically be treated like a NotFound error.
|
|
58
64
|
*/
|
|
59
65
|
(0, _defineProperty2.default)(ConnectionError, "defaultMessage", 'Failed to connect to socket');
|
|
60
66
|
var UnknownResponse = exports.UnknownResponse = /*#__PURE__*/function (_ConnectionError2) {
|
|
@@ -67,7 +73,8 @@ var UnknownResponse = exports.UnknownResponse = /*#__PURE__*/function (_Connecti
|
|
|
67
73
|
return (0, _createClass2.default)(UnknownResponse);
|
|
68
74
|
}(ConnectionError);
|
|
69
75
|
/**
|
|
70
|
-
*
|
|
76
|
+
* Thrown for CloseCode 4400.
|
|
77
|
+
* BadRequest usually implies an attempt to use service account credentials.
|
|
71
78
|
*/
|
|
72
79
|
(0, _defineProperty2.default)(UnknownResponse, "defaultMessage", 'UnknownResponse is produced by IE when we receive a 4XXX. You probably want to treat this like a NotFound');
|
|
73
80
|
var BadRequest = exports.BadRequest = /*#__PURE__*/function (_ConnectionError3) {
|
|
@@ -80,7 +87,8 @@ var BadRequest = exports.BadRequest = /*#__PURE__*/function (_ConnectionError3)
|
|
|
80
87
|
return (0, _createClass2.default)(BadRequest);
|
|
81
88
|
}(ConnectionError);
|
|
82
89
|
/**
|
|
83
|
-
*
|
|
90
|
+
* Thrown for CloseCode 4401.
|
|
91
|
+
* Indicates an authorization failure requiring a token refresh.
|
|
84
92
|
*/
|
|
85
93
|
(0, _defineProperty2.default)(BadRequest, "defaultMessage", 'BadRequest usually implies an attempt to use service account credentials');
|
|
86
94
|
var NotAuthorized = exports.NotAuthorized = /*#__PURE__*/function (_ConnectionError4) {
|
|
@@ -93,7 +101,8 @@ var NotAuthorized = exports.NotAuthorized = /*#__PURE__*/function (_ConnectionEr
|
|
|
93
101
|
return (0, _createClass2.default)(NotAuthorized);
|
|
94
102
|
}(ConnectionError);
|
|
95
103
|
/**
|
|
96
|
-
*
|
|
104
|
+
* Thrown for CloseCode 4403.
|
|
105
|
+
* Forbidden usually implies the credentials are not entitled for Webex.
|
|
97
106
|
*/
|
|
98
107
|
(0, _defineProperty2.default)(NotAuthorized, "defaultMessage", 'Please refresh your access token');
|
|
99
108
|
var Forbidden = exports.Forbidden = /*#__PURE__*/function (_ConnectionError5) {
|
|
@@ -105,5 +114,37 @@ var Forbidden = exports.Forbidden = /*#__PURE__*/function (_ConnectionError5) {
|
|
|
105
114
|
(0, _inherits2.default)(Forbidden, _ConnectionError5);
|
|
106
115
|
return (0, _createClass2.default)(Forbidden);
|
|
107
116
|
}(ConnectionError);
|
|
117
|
+
/**
|
|
118
|
+
* Creates a MobiusSocketResponseError from a socket response.
|
|
119
|
+
*
|
|
120
|
+
* @param response - The socket response that triggered the error
|
|
121
|
+
* @param statusCode - HTTP-style status code for the error
|
|
122
|
+
* @param statusMessage - Human-readable status message
|
|
123
|
+
* @returns A formatted error object with response details
|
|
124
|
+
*/
|
|
108
125
|
(0, _defineProperty2.default)(Forbidden, "defaultMessage", 'Forbidden usually implies these credentials are not entitled for Webex');
|
|
126
|
+
function createWssResponseError(response, statusCode, statusMessage) {
|
|
127
|
+
var error = new Error(statusMessage || "Mobius websocket request failed with status ".concat(statusCode || 'unknown'));
|
|
128
|
+
error.name = 'MobiusSocketResponseError';
|
|
129
|
+
error.statusCode = statusCode;
|
|
130
|
+
error.statusMessage = statusMessage;
|
|
131
|
+
error.response = response;
|
|
132
|
+
error.trackingId = response === null || response === void 0 ? void 0 : response.trackingId;
|
|
133
|
+
return error;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Creates a timeout error for a socket request that didn't receive a response.
|
|
138
|
+
*
|
|
139
|
+
* @param request - The socket request that timed out
|
|
140
|
+
* @returns A timeout error with status code 408
|
|
141
|
+
*/
|
|
142
|
+
function createTimeoutError(request) {
|
|
143
|
+
var errorPayload = {
|
|
144
|
+
type: 'response_event',
|
|
145
|
+
subtype: request.type,
|
|
146
|
+
trackingId: request.trackingId
|
|
147
|
+
};
|
|
148
|
+
return createWssResponseError(errorPayload, 408, 'Mobius websocket response timed out');
|
|
149
|
+
}
|
|
109
150
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_common","require","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","ConnectionError","exports","_Exception","event","_this","_classCallCheck2","_defineProperty2","_inherits2","_createClass2","key","value","parse","arguments","length","undefined","_defineProperties","code","reason","Exception","UnknownResponse","_ConnectionError2","BadRequest","_ConnectionError3","NotAuthorized","_ConnectionError4","Forbidden","_ConnectionError5"],"sources":["errors.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n// @ts-expect-error `@webex/common` is still JS-only and does not ship declarations.\nimport {Exception} from '@webex/common';\nimport type {SocketCloseEvent} from './socket/types';\n\n/**\n * Exception thrown when a websocket gets closed
|
|
1
|
+
{"version":3,"names":["_common","require","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","ConnectionError","exports","_Exception","event","_this","_classCallCheck2","_defineProperty2","_inherits2","_createClass2","key","value","parse","arguments","length","undefined","_defineProperties","code","reason","Exception","UnknownResponse","_ConnectionError2","BadRequest","_ConnectionError3","NotAuthorized","_ConnectionError4","Forbidden","_ConnectionError5","createWssResponseError","response","statusCode","statusMessage","error","Error","concat","name","trackingId","createTimeoutError","request","errorPayload","type","subtype"],"sources":["errors.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n// @ts-expect-error `@webex/common` is still JS-only and does not ship declarations.\nimport {Exception} from '@webex/common';\nimport type {SocketCloseEvent, SocketResponse} from './socket/types';\nimport {MobiusSocketResponseError} from './types';\n\n/**\n * Exception thrown when a websocket gets closed.\n */\nexport class ConnectionError extends Exception {\n static defaultMessage = 'Failed to connect to socket';\n\n code?: number;\n\n reason?: string;\n\n // eslint-disable-next-line no-useless-constructor\n constructor(event?: SocketCloseEvent) {\n super(event);\n }\n\n /**\n * Parses a close event and sets the code and reason properties.\n * @param event - Socket close event to parse\n * @returns The reason string from the event\n */\n parse(event: SocketCloseEvent = {}) {\n Object.defineProperties(this, {\n code: {\n value: event.code,\n },\n reason: {\n value: event.reason,\n },\n });\n\n return event.reason;\n }\n}\n\n/**\n * Thrown for CloseCode 1005.\n * UnknownResponse is produced by IE when we receive a 4XXX close code.\n * This should typically be treated like a NotFound error.\n */\nexport class UnknownResponse extends ConnectionError {\n static defaultMessage =\n 'UnknownResponse is produced by IE when we receive a 4XXX. You probably want to treat this like a NotFound';\n\n // eslint-disable-next-line no-useless-constructor\n constructor(event?: SocketCloseEvent) {\n super(event);\n }\n}\n\n/**\n * Thrown for CloseCode 4400.\n * BadRequest usually implies an attempt to use service account credentials.\n */\nexport class BadRequest extends ConnectionError {\n static defaultMessage =\n 'BadRequest usually implies an attempt to use service account credentials';\n\n // eslint-disable-next-line no-useless-constructor\n constructor(event?: SocketCloseEvent) {\n super(event);\n }\n}\n\n/**\n * Thrown for CloseCode 4401.\n * Indicates an authorization failure requiring a token refresh.\n */\nexport class NotAuthorized extends ConnectionError {\n static defaultMessage = 'Please refresh your access token';\n\n // eslint-disable-next-line no-useless-constructor\n constructor(event?: SocketCloseEvent) {\n super(event);\n }\n}\n\n/**\n * Thrown for CloseCode 4403.\n * Forbidden usually implies the credentials are not entitled for Webex.\n */\nexport class Forbidden extends ConnectionError {\n static defaultMessage = 'Forbidden usually implies these credentials are not entitled for Webex';\n\n // eslint-disable-next-line no-useless-constructor\n constructor(event?: SocketCloseEvent) {\n super(event);\n }\n}\n\n/**\n * Creates a MobiusSocketResponseError from a socket response.\n *\n * @param response - The socket response that triggered the error\n * @param statusCode - HTTP-style status code for the error\n * @param statusMessage - Human-readable status message\n * @returns A formatted error object with response details\n */\nexport function createWssResponseError(\n response: SocketResponse,\n statusCode?: number,\n statusMessage?: string\n): MobiusSocketResponseError {\n const error = new Error(\n statusMessage || `Mobius websocket request failed with status ${statusCode || 'unknown'}`\n ) as MobiusSocketResponseError;\n\n error.name = 'MobiusSocketResponseError';\n error.statusCode = statusCode;\n error.statusMessage = statusMessage;\n error.response = response;\n error.trackingId = response?.trackingId;\n\n return error;\n}\n\n/**\n * Creates a timeout error for a socket request that didn't receive a response.\n *\n * @param request - The socket request that timed out\n * @returns A timeout error with status code 408\n */\nexport function createTimeoutError(request: SocketResponse): MobiusSocketResponseError {\n const errorPayload = {\n type: 'response_event',\n subtype: request.type,\n trackingId: request.trackingId,\n };\n\n return createWssResponseError(errorPayload, 408, 'Mobius websocket response timed out');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAKA,IAAAA,OAAA,GAAAC,OAAA;AAAwC,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,kBAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,CAAAC,OAAA,EAAAJ,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAAA,SAAAI,0BAAA,cAAAN,CAAA,IAAAU,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAN,kBAAA,CAAAG,OAAA,iCAAAV,CAAA,aAAAM,yBAAA,YAAAA,0BAAA,aAAAN,CAAA,UALxC;AACA;AACA,GAFA,CAIA;AAKA;AACA;AACA;AAFA,IAGac,eAAe,GAAAC,OAAA,CAAAD,eAAA,0BAAAE,UAAA;EAO1B;EACA,SAAAF,gBAAYG,KAAwB,EAAE;IAAA,IAAAC,KAAA;IAAA,IAAAC,gBAAA,CAAAf,OAAA,QA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9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,IAAAM,gBAAA,CAAAhB,OAAA,EATamC,SAAS,oBACI,wEAAwE;AAgB3F,SAASE,sBAAsBA,CACpCC,QAAwB,EACxBC,UAAmB,EACnBC,aAAsB,EACK;EAC3B,IAAMC,KAAK,GAAG,IAAIC,KAAK,CACrBF,aAAa,mDAAAG,MAAA,CAAmDJ,UAAU,IAAI,SAAS,CACzF,CAA8B;EAE9BE,KAAK,CAACG,IAAI,GAAG,2BAA2B;EACxCH,KAAK,CAACF,UAAU,GAAGA,UAAU;EAC7BE,KAAK,CAACD,aAAa,GAAGA,aAAa;EACnCC,KAAK,CAACH,QAAQ,GAAGA,QAAQ;EACzBG,KAAK,CAACI,UAAU,GAAGP,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEO,UAAU;EAEvC,OAAOJ,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,kBAAkBA,CAACC,OAAuB,EAA6B;EACrF,IAAMC,YAAY,GAAG;IACnBC,IAAI,EAAE,gBAAgB;IACtBC,OAAO,EAAEH,OAAO,CAACE,IAAI;IACrBJ,UAAU,EAAEE,OAAO,CAACF;EACtB,CAAC;EAED,OAAOR,sBAAsB,CAACW,YAAY,EAAE,GAAG,EAAE,qCAAqC,CAAC;AACzF","ignoreList":[]}
|
|
@@ -29,19 +29,14 @@ function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymb
|
|
|
29
29
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /*!
|
|
30
30
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
31
31
|
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
* @param webex
|
|
36
|
-
* @param [mobiusSocketConfig]
|
|
37
|
-
* @returns
|
|
38
|
-
*/
|
|
39
|
-
var mobiusSocketInstance; // Keeping just one instance of MobiusSocket since there won't be multiple connections
|
|
32
|
+
// Singleton instance - keeping just one instance of MobiusSocket since there won't be multiple connections
|
|
33
|
+
var mobiusSocketInstance;
|
|
40
34
|
|
|
41
35
|
/**
|
|
42
36
|
* Creates or returns the singleton Mobius socket client for the provided Webex instance.
|
|
37
|
+
*
|
|
43
38
|
* @param webex - The Webex SDK instance
|
|
44
|
-
* @param
|
|
39
|
+
* @param mobiusSocketConfig - Optional configuration overrides
|
|
45
40
|
* @returns The singleton MobiusSocket instance
|
|
46
41
|
*/
|
|
47
42
|
function getMobiusSocketInstance(webex, mobiusSocketConfig) {
|
|
@@ -54,7 +49,6 @@ function getMobiusSocketInstance(webex, mobiusSocketConfig) {
|
|
|
54
49
|
|
|
55
50
|
/**
|
|
56
51
|
* Resets the singleton MobiusSocket instance, allowing a new one to be created.
|
|
57
|
-
* @returns
|
|
58
52
|
*/
|
|
59
53
|
function resetMobiusSocketInstance() {
|
|
60
54
|
mobiusSocketInstance = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["require","_mobiusSocket","_interopRequireDefault","_config","ownKeys","e","r","t","_Object$keys","_Object$getOwnPropertySymbols","o","filter","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","Object","forEach","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","mobiusSocketInstance","getMobiusSocketInstance","webex","mobiusSocketConfig","MobiusSocket","config","mobiusSocket","resetMobiusSocketInstance","undefined","_default","exports"],"sources":["index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport '@webex/internal-plugin-device';\nimport '@webex/internal-plugin-feature';\nimport '@webex/internal-plugin-metrics';\n\nimport type {WebexSDK} from '../SDKConnector/types';\nimport MobiusSocket from './mobius-socket';\nimport config, {MobiusSocketConfig} from './config';\n\n
|
|
1
|
+
{"version":3,"names":["require","_mobiusSocket","_interopRequireDefault","_config","ownKeys","e","r","t","_Object$keys","_Object$getOwnPropertySymbols","o","filter","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","Object","forEach","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","mobiusSocketInstance","getMobiusSocketInstance","webex","mobiusSocketConfig","MobiusSocket","config","mobiusSocket","resetMobiusSocketInstance","undefined","_default","exports"],"sources":["index.ts"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport '@webex/internal-plugin-device';\nimport '@webex/internal-plugin-feature';\nimport '@webex/internal-plugin-metrics';\n\nimport type {WebexSDK} from '../SDKConnector/types';\nimport MobiusSocket from './mobius-socket';\nimport config, {MobiusSocketConfig} from './config';\n\n// Singleton instance - keeping just one instance of MobiusSocket since there won't be multiple connections\nlet mobiusSocketInstance: MobiusSocket | undefined;\n\n/**\n * Creates or returns the singleton Mobius socket client for the provided Webex instance.\n *\n * @param webex - The Webex SDK instance\n * @param mobiusSocketConfig - Optional configuration overrides\n * @returns The singleton MobiusSocket instance\n */\nexport function getMobiusSocketInstance(\n webex: WebexSDK,\n mobiusSocketConfig?: Partial<MobiusSocketConfig>\n): MobiusSocket {\n if (mobiusSocketInstance) {\n return mobiusSocketInstance;\n }\n\n mobiusSocketInstance = new MobiusSocket(webex, {\n ...config.mobiusSocket,\n ...mobiusSocketConfig,\n });\n\n return mobiusSocketInstance;\n}\n\n/**\n * Resets the singleton MobiusSocket instance, allowing a new one to be created.\n */\nexport function resetMobiusSocketInstance() {\n mobiusSocketInstance = undefined;\n}\n\nexport default MobiusSocket;\nexport {Mob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