From ee87a2dfc08d12cdcdba4983c0f134e04198ee84 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Wed, 5 Oct 2022 22:41:45 +0300 Subject: [PATCH] Created 7.0.0-rc1 build version --- dist/wampy.js | 2 +- dist/wampy.js.map | 2 +- package.json | 2 +- src/wampy.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/wampy.js b/dist/wampy.js index 009639b..28f0c3c 100644 --- a/dist/wampy.js +++ b/dist/wampy.js @@ -58,7 +58,7 @@ var Wampy = /*#__PURE__*/function () { * @type {string} * @private */ - this.version = 'v7.0.0'; + this.version = 'v7.0.0-rc1'; /** * WS Url * @type {string} diff --git a/dist/wampy.js.map b/dist/wampy.js.map index 2eacb42..99a904c 100644 --- a/dist/wampy.js.map +++ b/dist/wampy.js.map @@ -1 +1 @@ -{"version":3,"file":"wampy.js","names":["jsonSerializer","JsonSerializer","Wampy","url","options","version","_url","_protocols","_wamp_features","agent","roles","publisher","features","subscriber_blackwhite_listing","publisher_exclusion","publisher_identification","payload_passthru_mode","subscriber","pattern_based_subscription","publication_trustlevels","caller","caller_identification","progressive_call_results","call_canceling","call_timeout","callee","call_trustlevels","pattern_based_registration","shared_registration","_cache","sessionId","reqId","server_wamp_features","isSayingGoodbye","opStatus","code","error","timer","reconnectingAttempts","connectPromise","closePromise","_ws","_wsQueue","_requests","_calls","_subscriptions","_subsTopics","Set","_rpcRegs","_rpcNames","_options","debug","logger","autoReconnect","reconnectInterval","maxRetries","realm","helloCustomDetails","uriValidation","authid","authmethods","authextra","authPlugins","authMode","onChallenge","onClose","onError","onReconnect","onReconnectSuccess","ws","additionalHeaders","wsRequestOptions","serializer","payloadSerializers","json","_isPlainObject","_merge","args","console","log","obj","l","length","i","attr","Array","isArray","_isObject","ctor","constructor","prot","prototype","Object","hasOwnProperty","call","toString","protocol","err","topicType","role","Errors","NoDealerError","NoBrokerError","_fillOpStatusByError","_validateURI","topic","patternBased","allowWAMP","UriError","feature","_checkRouterFeature","PPTNotSupportedError","ppt_scheme","search","PPTInvalidSchemeError","E2EE_SERIALIZERS","includes","ppt_serializer","PPTSerializerInvalidError","uri","reBase","rePattern","re","test","indexOf","payload","payloadItems","argsList","argsDict","_isArray","binPayload","pptPayload","kwargs","pptSerializer","encode","e","PPTSerializationError","push","_checkPPTOptions","decode","decodedPayload","msg","_hardClose","errorUri","details","_log","_send","WAMP_MSG_SPEC","ABORT","message","close","_encode","readyState","send","shift","SUCCESS","onopen","_wsOnOpen","onclose","event","_wsOnClose","onmessage","_wsOnMessage","onerror","_wsOnError","serverProtocol","split","NoSerializerAvailableError","isBinary","binaryType","HELLO","setTimeout","_wsReconnect","onSuccess","_resetState","_decode","data","self","WELCOME","CHALLENGE","GOODBYE","ERROR","SUBSCRIBED","UNSUBSCRIBED","PUBLISHED","EVENT","RESULT","REGISTERED","UNREGISTERED","INVOCATION","_renewSubscriptions","_renewRegistrations","p","Promise","resolve","reject","NoCRACallbackOrIdError","then","key","AUTHENTICATE","ChallengeExceptionError","SUBSCRIBE","UNSUBSCRIBE","PUBLISH","REGISTER","UNREGISTER","CALL","callbacks","id","onEvent","advancedOptions","add","requestId","subscriptionId","has","publicationId","_unpackPPTPayload","progress","onProgress","rpc","registrationId","invoke_error_handler","invoke_result_handler","results","YIELD","pptScheme","ppt_cipher","ppt_keyid","res","_packPPTPayload","concat","result_handler","error_handler","WAMP_ERROR_MSG","NON_EXIST_RPC_INVOCATION","getWebSocket","_initWsCallbacks","subs","st","subscribe","rpcs","rn","rpcName","register","opts","authOpts","keys","_setWsProtocols","NoWsOrUrlError","NoRealmError","defer","getNewPromise","promise","topicURI","match","InvalidParamError","_preReqChecks","NoCallbackError","_getReqId","splice","NonExistUnsubscribeError","acknowledge","_optionsConvertHelper","option","sourceType","exclude_me","disclose_me","progress_callback","receive_progress","timeout","NonExistRPCReqIdError","mode","CANCEL","invoke","RPCAlreadyRegisteredError","NonExistRPCUnregistrationError"],"sources":["../src/wampy.js"],"sourcesContent":["/**\n * Project: wampy.js\n *\n * https://github.com/KSDaemon/wampy.js\n *\n * A lightweight client-side implementation of\n * WAMP (The WebSocket Application Messaging Protocol v2)\n * http://wamp.ws\n *\n * Provides asynchronous RPC/PubSub over WebSocket.\n *\n * Copyright 2014 KSDaemon. Licensed under the MIT License.\n * See @license text at http://www.opensource.org/licenses/mit-license.php\n *\n */\n\nimport { WAMP_MSG_SPEC, WAMP_ERROR_MSG, E2EE_SERIALIZERS, SUCCESS } from './constants.js';\nimport * as Errors from './errors.js';\nimport { getWebSocket, getNewPromise } from './utils.js';\nimport { JsonSerializer } from './serializers/JsonSerializer.js';\nconst jsonSerializer = new JsonSerializer();\n\n/**\n * WAMP Client Class\n */\nclass Wampy {\n\n /**\n * Wampy constructor\n * @param {string} [url]\n * @param {Object} [options]\n */\n constructor (url, options) {\n\n /**\n * Wampy version\n * @type {string}\n * @private\n */\n this.version = 'v7.0.0';\n\n /**\n * WS Url\n * @type {string}\n * @private\n */\n this._url = (typeof url === 'string') ? url : null;\n\n /**\n * WS protocols\n * @type {Array}\n * @private\n */\n this._protocols = ['wamp.2.json'];\n\n /**\n * WAMP features, supported by Wampy\n * @type {object}\n * @private\n */\n this._wamp_features = {\n agent: 'Wampy.js ' + this.version,\n roles: {\n publisher : {\n features: {\n subscriber_blackwhite_listing: true,\n publisher_exclusion : true,\n publisher_identification : true,\n payload_passthru_mode : true\n }\n },\n subscriber: {\n features: {\n pattern_based_subscription: true,\n publication_trustlevels : true,\n publisher_identification : true,\n payload_passthru_mode : true\n }\n },\n caller : {\n features: {\n caller_identification : true,\n progressive_call_results: true,\n call_canceling : true,\n call_timeout : true,\n payload_passthru_mode : true\n }\n },\n callee : {\n features: {\n caller_identification : true,\n call_trustlevels : true,\n pattern_based_registration: true,\n shared_registration : true,\n payload_passthru_mode : true\n\n }\n }\n }\n };\n\n /**\n * Internal cache for object lifetime\n * @type {Object}\n * @private\n */\n this._cache = {\n /**\n * WAMP Session ID\n * @type {string|null}\n */\n sessionId: null,\n\n /**\n * WAMP Session scope requests ID\n * @type {int}\n */\n reqId: 0,\n\n /**\n * Server WAMP roles and features\n */\n server_wamp_features: { roles: {} },\n\n /**\n * Are we in state of saying goodbye\n * @type {boolean}\n */\n isSayingGoodbye: false,\n\n /**\n * Status of last operation\n */\n opStatus: {\n\n /**\n * Int code of last operation\n * @type {int}\n */\n code: 0,\n\n /**\n * Error of last operation (if not was successful)\n * @type {Error}\n */\n error: null,\n\n /**\n * Request ID of last successfully sent operation\n * @type {int}\n */\n reqId: 0\n },\n\n /**\n * Timer for reconnection\n * @type {int|null}\n */\n timer: null,\n\n /**\n * Reconnection attempts\n * @type {number}\n */\n reconnectingAttempts: 0,\n\n /**\n * Promise for onConnect\n */\n connectPromise: null,\n\n /**\n * Promise for onClose\n */\n closePromise: null\n };\n\n /**\n * WebSocket object\n * @type {WebSocket}\n * @private\n */\n this._ws = null;\n\n /**\n * Internal queue for websocket requests, for case of disconnect\n * @type {Array}\n * @private\n */\n this._wsQueue = [];\n\n /**\n * Internal queue for wamp requests\n * @type {object}\n * @private\n */\n this._requests = {};\n\n /**\n * Stored RPC\n * @type {object}\n * @private\n */\n this._calls = {};\n\n /**\n * Stored Pub/Sub\n * @type {object}\n * @private\n */\n this._subscriptions = {};\n\n /**\n * Stored Pub/Sub topics\n * @type {Set}\n * @private\n */\n this._subsTopics = new Set();\n\n /**\n * Stored RPC Registrations\n * @type {object}\n * @private\n */\n this._rpcRegs = {};\n\n /**\n * Stored RPC names\n * @type {Set}\n * @private\n */\n this._rpcNames = new Set();\n\n /**\n * Options hash-table\n * @type {Object}\n * @private\n */\n this._options = {\n /**\n * Logging\n * @type {boolean}\n */\n debug: false,\n\n /**\n * Logger\n * @type {function}\n */\n logger: null,\n\n /**\n * Reconnecting flag\n * @type {boolean}\n */\n autoReconnect: true,\n\n /**\n * Reconnecting interval (in ms)\n * @type {number}\n */\n reconnectInterval: 2 * 1000,\n\n /**\n * Maximum reconnection retries\n * @type {number}\n */\n maxRetries: 25,\n\n /**\n * WAMP Realm to join\n * @type {string|null}\n */\n realm: null,\n\n /**\n * Custom attributes to send to router on hello\n * @type {object}\n */\n helloCustomDetails: null,\n\n /**\n * Validation of the topic URI structure\n * @type {string} - strict or loose\n */\n uriValidation: 'strict',\n\n /**\n * Authentication id to use in challenge\n * @type {string|null}\n */\n authid: null,\n\n /**\n * Supported authentication methods\n * @type {array}\n */\n authmethods: [],\n\n /**\n * Additional authentication options (used in WAMP CryptoSign for example)\n * @type {object}\n */\n authextra: {},\n\n /**\n * Authentication helpers for processing different authmethods challenge flows\n * @type {object}\n */\n authPlugins: {},\n\n /**\n * Mode of authorization flow\n * Possible values: manual | auto\n * @type {string}\n */\n authMode: 'manual',\n\n /**\n * onChallenge callback\n * @type {function}\n */\n onChallenge: null,\n\n /**\n * onClose callback\n * @type {function}\n */\n onClose: null,\n\n /**\n * onError callback\n * @type {function}\n */\n onError: null,\n\n /**\n * onReconnect callback\n * @type {function}\n */\n onReconnect: null,\n\n /**\n * onReconnectSuccess callback\n * @type {function}\n */\n onReconnectSuccess: null,\n\n /**\n * User provided WebSocket class\n * @type {function}\n */\n ws: null,\n\n /**\n * User provided additional HTTP headers (for use in Node.js enviroment)\n * @type {object}\n */\n additionalHeaders: null,\n\n /**\n * User provided WS Client Config Options (for use in Node.js enviroment)\n * @type {object}\n */\n wsRequestOptions: null,\n\n /**\n * User provided Serializer class\n * @type {object}\n */\n serializer: jsonSerializer,\n\n /**\n * User provided Serializers for Payload Passthru Mode\n * @type {object}\n */\n payloadSerializers: {\n json: jsonSerializer\n }\n };\n\n if (this._isPlainObject(options)) {\n this._options = this._merge(this._options, options);\n } else if (this._isPlainObject(url)) {\n this._options = this._merge(this._options, url);\n }\n\n }\n\n /* Internal utils methods */\n /**\n * Internal logger\n * @private\n */\n _log (...args) {\n if (this._options.debug) {\n if (this._options.logger) {\n this._options.logger(args);\n } else {\n console.log('[wampy]', args);\n }\n }\n }\n\n /**\n * Get the new unique request id\n * @returns {number}\n * @private\n */\n _getReqId () {\n return ++this._cache.reqId;\n }\n\n /**\n * Merge argument objects into one\n * @returns {Object}\n * @private\n */\n _merge (...args) {\n const obj = {}, l = args.length;\n let i, attr;\n\n for (i = 0; i < l; i++) {\n for (attr in args[i]) {\n obj[attr] = args[i][attr];\n }\n }\n return obj;\n }\n\n /**\n * Check if value is array\n * @param obj\n * @returns {boolean}\n * @private\n */\n _isArray (obj) {\n return (!!obj) && (Array.isArray(obj));\n }\n\n /**\n * Check if value is object literal\n * @param obj\n * @returns {boolean}\n * @private\n */\n _isPlainObject (obj) {\n if (!this._isObject(obj)) {\n return false;\n }\n\n // If obj has modified constructor\n const ctor = obj.constructor;\n if (typeof ctor !== 'function') {\n return false;\n }\n\n // If obj has modified prototype\n const prot = ctor.prototype;\n if (this._isObject(prot) === false) {\n return false;\n }\n\n // If constructor does not have an Object-specific method\n return Object.hasOwnProperty.call(prot, 'isPrototypeOf') !== false;\n }\n\n /**\n * Check if value is an object\n * @param obj\n * @returns {boolean}\n * @private\n */\n _isObject (obj) {\n return obj !== null\n && typeof obj === 'object'\n && Array.isArray(obj) === false\n && Object.prototype.toString.call(obj) === '[object Object]';\n }\n\n /**\n * Set websocket protocol based on options\n * @private\n */\n _setWsProtocols () {\n this._protocols = ['wamp.2.' + this._options.serializer.protocol];\n }\n\n /**\n * Fill instance operation status\n * @param {Error} err\n * @private\n */\n _fillOpStatusByError (err) {\n this._cache.opStatus = {\n code: err.code,\n error: err,\n reqId: 0\n };\n }\n\n /**\n * Prerequisite checks for any wampy api call\n * @param {object} topicType { topic: URI, patternBased: true|false, allowWAMP: true|false }\n * @param {string} role\n * @returns {boolean}\n * @private\n */\n _preReqChecks (topicType, role) {\n let err;\n\n if (this._cache.sessionId && !this._cache.server_wamp_features.roles[role]) {\n switch (role) {\n case 'dealer':\n err = new Errors.NoDealerError();\n break;\n case 'broker':\n err = new Errors.NoBrokerError();\n break;\n }\n this._fillOpStatusByError(err);\n return false;\n }\n\n if (topicType && !this._validateURI(topicType.topic, topicType.patternBased, topicType.allowWAMP)) {\n this._fillOpStatusByError(new Errors.UriError());\n return false;\n }\n\n return true;\n }\n\n /**\n * Check for specified feature in a role of connected WAMP Router\n * @param {string} role\n * @param {string} feature\n * @returns {boolean}\n * @private\n */\n _checkRouterFeature (role, feature) {\n return this._cache.server_wamp_features.roles[role].features[feature] === true;\n }\n\n /**\n * Check for PPT mode options correctness\n * @param {string} role WAMP Router Role to check support\n * @param {object} options\n * @returns {boolean}\n * @private\n */\n _checkPPTOptions (role, options) {\n if (!this._checkRouterFeature(role, 'payload_passthru_mode')) {\n this._fillOpStatusByError(new Errors.PPTNotSupportedError());\n return false;\n }\n\n if (options.ppt_scheme.search(/^(wamp$|mqtt$|x_)/) < 0) {\n this._fillOpStatusByError(new Errors.PPTInvalidSchemeError());\n return false;\n }\n\n if (options.ppt_scheme === 'wamp' && !E2EE_SERIALIZERS.includes(options.ppt_serializer)) {\n this._fillOpStatusByError(new Errors.PPTSerializerInvalidError());\n return false;\n }\n\n return true;\n }\n\n /**\n * Validate uri\n * @param {string} uri\n * @param {boolean} patternBased\n * @param {boolean} allowWAMP\n * @returns {boolean}\n * @private\n */\n _validateURI (uri, patternBased, allowWAMP) {\n let reBase;\n let rePattern;\n\n if (this._options.uriValidation === 'strict') {\n reBase = /^([0-9a-zA-Z_]+\\.)*([0-9a-zA-Z_]+)$/;\n rePattern = /^([0-9a-zA-Z_]+\\.{1,2})*([0-9a-zA-Z_]+)$/;\n } else if (this._options.uriValidation === 'loose') {\n reBase = /^([^\\s.#]+\\.)*([^\\s.#]+)$/;\n rePattern = /^([^\\s.#]+\\.{1,2})*([^\\s.#]+)$/;\n } else {\n return false;\n }\n const re = patternBased ? rePattern : reBase;\n\n if (allowWAMP) {\n return re.test(uri);\n } else {\n return !(!re.test(uri) || uri.indexOf('wamp.') === 0);\n }\n }\n\n /**\n * Prepares PPT/E2EE payload for adding to WAMP message\n * @param {string|number|Array|object} payload\n * @param {Object} options\n * @returns {Object}\n * @private\n */\n _packPPTPayload (payload, options) {\n let payloadItems = [], err = false, argsList, argsDict;\n\n if (this._isArray(payload)) {\n argsList = payload;\n } else if (this._isPlainObject(payload)) {\n // It's a wampy unified form of payload passing\n if (payload.argsList || payload.argsDict) {\n if (this._isArray(payload.argsList)) {\n argsList = payload.argsList;\n } else if (typeof (payload.argsList) !== 'undefined') {\n argsList = [payload.argsList];\n }\n\n if (payload.argsDict) {\n argsDict = payload.argsDict;\n }\n } else {\n argsDict = payload;\n }\n } else { // assume it's a single value\n argsList = [payload];\n }\n\n // Check and handle Payload PassThru Mode\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-passthru-mode\n if (options.ppt_scheme) {\n let binPayload, pptPayload = { args: argsList, kwargs: argsDict };\n\n if (options.ppt_serializer && options.ppt_serializer !== 'native') {\n let pptSerializer = this._options.payloadSerializers[options.ppt_serializer];\n\n if (!pptSerializer) {\n err = true;\n this._fillOpStatusByError(new Errors.PPTSerializerInvalidError());\n return { err, payloadItems };\n }\n\n try {\n binPayload = pptSerializer.encode(pptPayload);\n } catch (e) {\n err = true;\n this._fillOpStatusByError(new Errors.PPTSerializationError());\n return { err, payloadItems };\n }\n } else {\n binPayload = pptPayload;\n }\n\n // wamp scheme means Payload End-to-End Encryption\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-end-to-end-encrypti\n if (options.ppt_scheme === 'wamp') {\n\n // TODO: implement End-to-End Encryption\n }\n\n payloadItems.push([binPayload]);\n\n } else {\n if (argsList) {\n payloadItems.push(argsList);\n }\n if (argsDict) {\n if (!argsList) {\n payloadItems.push([]);\n }\n payloadItems.push(argsDict);\n }\n }\n\n return { err, payloadItems };\n }\n\n /**\n * Unpack PPT/E2EE payload to common\n * @param {string} role\n * @param {Array} pptPayload\n * @param {Object} options\n * @returns {Object}\n * @private\n */\n async _unpackPPTPayload (role, pptPayload, options) {\n let err = false, decodedPayload;\n\n if (!this._checkPPTOptions(role, options)) {\n return { err: this._cache.opStatus.error };\n }\n\n // wamp scheme means Payload End-to-End Encryption\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-end-to-end-encrypti\n if (options.ppt_scheme === 'wamp') {\n\n // TODO: implement End-to-End Encryption\n\n }\n\n if (options.ppt_serializer && options.ppt_serializer !== 'native') {\n let pptSerializer = this._options.payloadSerializers[options.ppt_serializer];\n\n if (!pptSerializer) {\n return { err: new Errors.PPTSerializerInvalidError() };\n }\n\n try {\n decodedPayload = await pptSerializer.decode(pptPayload);\n } catch (e) {\n return { err: new Errors.PPTSerializationError() };\n }\n } else {\n decodedPayload = pptPayload;\n }\n return { err, args: decodedPayload.args, kwargs: decodedPayload.kwargs };\n }\n\n /**\n * Encode WAMP message\n * @param {Array} msg\n * @returns {*}\n * @private\n */\n _encode (msg) {\n try {\n return this._options.serializer.encode(msg);\n } catch (e) {\n this._hardClose('wamp.error.protocol_violation', 'Can not encode message');\n }\n }\n\n /**\n * Decode WAMP message\n * @param msg\n * @returns {Promise}\n * @private\n */\n _decode (msg) {\n return this._options.serializer.decode(msg);\n }\n\n /**\n * Hard close of connection due to protocol violations\n * @param {string} errorUri\n * @param {string} details\n * @private\n */\n _hardClose (errorUri, details) {\n this._log(details);\n // Cleanup outgoing message queue\n this._wsQueue = [];\n this._send([WAMP_MSG_SPEC.ABORT, { message: details }, errorUri]);\n\n // In case we were just making first connection\n if (this._cache.connectPromise) {\n this._cache.connectPromise.onError(errorUri);\n this._cache.connectPromise = null;\n }\n\n if (this._options.onError) {\n this._options.onError({ error: errorUri, details: details });\n }\n\n this._ws.close();\n }\n\n /**\n * Send encoded message to server\n * @param {Array} [msg]\n * @private\n */\n _send (msg) {\n if (msg) {\n this._wsQueue.push(this._encode(msg));\n }\n\n if (this._ws && this._ws.readyState === 1 && this._cache.sessionId) {\n while (this._wsQueue.length) {\n this._ws.send(this._wsQueue.shift());\n }\n }\n }\n\n /**\n * Reset internal state and cache\n * @private\n */\n _resetState () {\n this._wsQueue = [];\n this._subscriptions = {};\n this._subsTopics = new Set();\n this._requests = {};\n this._calls = {};\n this._rpcRegs = {};\n this._rpcNames = new Set();\n\n // Just keep attrs that are have to be present\n this._cache = {\n reqId : 0,\n reconnectingAttempts: 0,\n opStatus : SUCCESS,\n closePromise : null,\n connectPromise : null,\n };\n }\n\n /**\n * Initialize internal websocket callbacks\n * @private\n */\n _initWsCallbacks () {\n if (this._ws) {\n this._ws.onopen = () => {\n this._wsOnOpen();\n };\n this._ws.onclose = event => {\n this._wsOnClose(event);\n };\n this._ws.onmessage = event => {\n this._wsOnMessage(event);\n };\n this._ws.onerror = error => {\n this._wsOnError(error);\n };\n }\n }\n\n /**\n * Internal websocket on open callback\n * @private\n */\n _wsOnOpen () {\n const options = this._merge(this._options.helloCustomDetails, this._wamp_features),\n serverProtocol = this._ws.protocol ? this._ws.protocol.split('.')[2] : '';\n if (this._options.authid) {\n options.authmethods = this._options.authmethods;\n options.authid = this._options.authid;\n options.authextra = this._options.authextra;\n }\n\n this._log('websocket connected');\n\n if (this._options.serializer.protocol !== serverProtocol) {\n // Server have chosen not our preferred protocol\n\n // Falling back to json if possible\n // Temp hack for React Native Environment is removed as\n // (facebook/react-native#24796) was resolved\n if (serverProtocol === 'json') {\n this._options.serializer = new JsonSerializer();\n } else {\n this._fillOpStatusByError(new Errors.NoSerializerAvailableError());\n return this;\n }\n\n }\n\n if (this._options.serializer.isBinary) {\n this._ws.binaryType = 'arraybuffer';\n }\n\n // WAMP SPEC: [HELLO, Realm|uri, Details|dict]\n // Sending directly 'cause it's a hello msg and no sessionId check is needed\n this._ws.send(this._encode([WAMP_MSG_SPEC.HELLO, this._options.realm, options]));\n }\n\n /**\n * Internal websocket on close callback\n * @param {object} event\n * @private\n */\n _wsOnClose (event) {\n this._log('websocket disconnected. Info: ', event);\n\n // Automatic reconnection\n if ((this._cache.sessionId || this._cache.reconnectingAttempts) &&\n this._options.autoReconnect &&\n (this._options.maxRetries === 0 ||\n this._cache.reconnectingAttempts < this._options.maxRetries) &&\n !this._cache.isSayingGoodbye) {\n this._cache.sessionId = null;\n this._cache.timer = setTimeout(() => {\n this._wsReconnect();\n }, this._options.reconnectInterval);\n } else {\n // No reconnection needed or reached max retries count\n if (this._options.onClose) {\n this._options.onClose();\n } else if (this._cache.closePromise) {\n this._cache.closePromise.onSuccess();\n this._cache.closePromise = null;\n }\n this._resetState();\n this._ws = null;\n }\n }\n\n /**\n * Internal websocket on event callback\n * @param {object} event\n * @private\n */\n async _wsOnMessage (event) {\n let data;\n try {\n data = await this._decode(event.data);\n } catch (e) {\n this._hardClose('wamp.error.protocol_violation', 'Can not decode received message');\n }\n\n this._log('websocket message received: ', data);\n\n let id, i, p, self = this;\n\n switch (data[0]) {\n case WAMP_MSG_SPEC.WELCOME:\n // WAMP SPEC: [WELCOME, Session|id, Details|dict]\n if (this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received WELCOME message after session was established');\n } else {\n this._cache.sessionId = data[1];\n this._cache.server_wamp_features = data[2];\n\n if (this._cache.reconnectingAttempts) {\n // There was reconnection\n\n this._cache.reconnectingAttempts = 0;\n\n if (this._options.onReconnectSuccess) {\n this._options.onReconnectSuccess(data[2]);\n }\n\n // Let's renew all previous state\n this._renewSubscriptions();\n this._renewRegistrations();\n\n } else {\n // Firing onConnect event on real connection to WAMP server\n this._cache.connectPromise.onSuccess(data[2]);\n this._cache.connectPromise = null;\n }\n\n // Send local queue if there is something out there\n this._send();\n }\n break;\n case WAMP_MSG_SPEC.ABORT:\n // WAMP SPEC: [ABORT, Details|dict, Reason|uri]\n if (this._options.onError) {\n this._options.onError({ error: data[2], details: data[1] });\n }\n this._ws.close();\n break;\n case WAMP_MSG_SPEC.CHALLENGE:\n // WAMP SPEC: [CHALLENGE, AuthMethod|string, Extra|dict]\n if (this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received CHALLENGE message after session was established');\n break;\n } else if (this._options.authid &&\n this._options.authMode === 'manual' &&\n typeof this._options.onChallenge === 'function') {\n\n p = new Promise((resolve, reject) => {\n resolve(this._options.onChallenge(data[1], data[2]));\n });\n\n } else if (this._options.authid &&\n this._options.authMode === 'auto' &&\n typeof this._options.authPlugins[data[1]] === 'function') {\n\n p = new Promise((resolve, reject) => {\n resolve(this._options.authPlugins[data[1]](data[1], data[2]));\n });\n\n } else {\n let error = new Errors.NoCRACallbackOrIdError();\n\n this._ws.send(this._encode([\n WAMP_MSG_SPEC.ABORT,\n { message: error.message },\n 'wamp.error.cannot_authenticate'\n ]));\n if (this._options.onError) {\n this._options.onError({ error });\n }\n this._ws.close();\n this._fillOpStatusByError(error);\n break;\n }\n\n p.then((key) => {\n\n // Sending directly 'cause it's a challenge msg and no sessionId check is needed\n this._ws.send(this._encode([WAMP_MSG_SPEC.AUTHENTICATE, key, {}]));\n\n }).catch(e => {\n let error = new Errors.ChallengeExceptionError();\n\n this._ws.send(this._encode([\n WAMP_MSG_SPEC.ABORT,\n { message: error.message },\n 'wamp.error.cannot_authenticate'\n ]));\n if (this._options.onError) {\n this._options.onError({ error });\n }\n this._ws.close();\n this._fillOpStatusByError(error);\n });\n\n break;\n case WAMP_MSG_SPEC.GOODBYE:\n // WAMP SPEC: [GOODBYE, Details|dict, Reason|uri]\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received GOODBYE message before session was established');\n } else {\n if (!this._cache.isSayingGoodbye) { // get goodbye, initiated by server\n this._cache.isSayingGoodbye = true;\n this._send([WAMP_MSG_SPEC.GOODBYE, {}, 'wamp.close.goodbye_and_out']);\n }\n this._cache.sessionId = null;\n this._ws.close();\n }\n break;\n case WAMP_MSG_SPEC.ERROR:\n // WAMP SPEC: [ERROR, REQUEST.Type|int, REQUEST.Request|id, Details|dict,\n // Error|uri, (Arguments|list, ArgumentsKw|dict)]\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received ERROR message before session was established');\n } else {\n switch (data[1]) {\n case WAMP_MSG_SPEC.SUBSCRIBE:\n case WAMP_MSG_SPEC.UNSUBSCRIBE:\n case WAMP_MSG_SPEC.PUBLISH:\n case WAMP_MSG_SPEC.REGISTER:\n case WAMP_MSG_SPEC.UNREGISTER:\n\n this._requests[data[2]] && this._requests[data[2]].callbacks.onError &&\n this._requests[data[2]].callbacks.onError({\n error : data[4],\n details : data[3],\n argsList: data[5],\n argsDict: data[6]\n });\n delete this._requests[data[2]];\n\n break;\n // case WAMP_MSG_SPEC.INVOCATION:\n // break;\n case WAMP_MSG_SPEC.CALL:\n\n // WAMP SPEC: [ERROR, CALL, CALL.Request|id, Details|dict,\n // Error|uri, Arguments|list, ArgumentsKw|dict]\n this._calls[data[2]] && this._calls[data[2]].onError &&\n this._calls[data[2]].onError({\n error : data[4],\n details : data[3],\n argsList: data[5],\n argsDict: data[6]\n });\n delete this._calls[data[2]];\n\n break;\n default:\n this._hardClose('wamp.error.protocol_violation', 'Received invalid ERROR message');\n break;\n }\n }\n break;\n case WAMP_MSG_SPEC.SUBSCRIBED:\n // WAMP SPEC: [SUBSCRIBED, SUBSCRIBE.Request|id, Subscription|id]\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received SUBSCRIBED message before session was established');\n } else {\n if (this._requests[data[1]]) {\n this._subscriptions[this._requests[data[1]].topic] = this._subscriptions[data[2]] = {\n id : data[2],\n callbacks : [this._requests[data[1]].callbacks.onEvent],\n advancedOptions: this._requests[data[1]].advancedOptions\n };\n\n this._subsTopics.add(this._requests[data[1]].topic);\n\n if (this._requests[data[1]].callbacks.onSuccess) {\n this._requests[data[1]].callbacks.onSuccess({\n topic : this._requests[data[1]].topic,\n requestId : data[1],\n subscriptionId: data[2]\n });\n }\n\n delete this._requests[data[1]];\n\n }\n }\n break;\n case WAMP_MSG_SPEC.UNSUBSCRIBED:\n // WAMP SPEC: [UNSUBSCRIBED, UNSUBSCRIBE.Request|id]\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received UNSUBSCRIBED message before session was established');\n } else {\n if (this._requests[data[1]]) {\n id = this._subscriptions[this._requests[data[1]].topic].id;\n delete this._subscriptions[this._requests[data[1]].topic];\n delete this._subscriptions[id];\n\n if (this._subsTopics.has(this._requests[data[1]].topic)) {\n this._subsTopics.delete(this._requests[data[1]].topic);\n }\n\n if (this._requests[data[1]].callbacks.onSuccess) {\n this._requests[data[1]].callbacks.onSuccess({\n topic : this._requests[data[1]].topic,\n requestId: data[1]\n });\n }\n\n delete this._requests[data[1]];\n }\n }\n break;\n case WAMP_MSG_SPEC.PUBLISHED:\n // WAMP SPEC: [PUBLISHED, PUBLISH.Request|id, Publication|id]\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received PUBLISHED message before session was established');\n } else {\n if (this._requests[data[1]]) {\n if (this._requests[data[1]].callbacks && this._requests[data[1]].callbacks.onSuccess) {\n this._requests[data[1]].callbacks.onSuccess({\n topic : this._requests[data[1]].topic,\n requestId : data[1],\n publicationId: data[2]\n });\n }\n\n delete this._requests[data[1]];\n }\n }\n break;\n case WAMP_MSG_SPEC.EVENT:\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received EVENT message before session was established');\n } else {\n if (this._subscriptions[data[1]]) {\n let argsList, argsDict, options = data[3];\n\n // WAMP SPEC: [EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id,\n // Details|dict, PUBLISH.Arguments|list, PUBLISH.ArgumentKw|dict]\n\n // Check and handle Payload PassThru Mode\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-passthru-mode\n if (options.ppt_scheme) {\n let decodedPayload, pptPayload = data[4][0];\n\n decodedPayload = await this._unpackPPTPayload('broker', pptPayload, options);\n\n if (decodedPayload.err) {\n // Since it is async publication, and no link to\n // original publication - as it was already published\n // we can not reply with error, only log it.\n // Although the router should handle it\n this._log(decodedPayload.err.message);\n break;\n }\n\n argsList = decodedPayload.args;\n argsDict = decodedPayload.kwargs;\n\n } else {\n argsList = data[4];\n argsDict = data[5];\n }\n\n i = this._subscriptions[data[1]].callbacks.length;\n while (i--) {\n this._subscriptions[data[1]].callbacks[i]({\n details : options,\n argsList: argsList,\n argsDict: argsDict\n });\n }\n }\n }\n break;\n case WAMP_MSG_SPEC.RESULT:\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received RESULT message before session was established');\n } else {\n if (this._calls[data[1]]) {\n let argsList, argsDict, options = data[2];\n\n // WAMP SPEC: [RESULT, CALL.Request|id, Details|dict,\n // YIELD.Arguments|list, YIELD.ArgumentsKw|dict]\n\n // Check and handle Payload PassThru Mode\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-passthru-mode\n if (options.ppt_scheme) {\n let decodedPayload, pptPayload = data[3][0];\n\n decodedPayload = await this._unpackPPTPayload('dealer', pptPayload, options);\n\n if (decodedPayload.err) {\n this._log(decodedPayload.err.message);\n this._cache.opStatus = decodedPayload.err;\n this._calls[data[1]].onError({\n error : decodedPayload.err.message,\n details : data[2],\n argsList: data[3],\n argsDict: data[4]\n });\n delete this._calls[data[1]];\n break;\n }\n\n argsList = decodedPayload.args;\n argsDict = decodedPayload.kwargs;\n\n } else {\n argsList = data[3];\n argsDict = data[4];\n }\n\n if (options.progress === true) {\n this._calls[data[1]].onProgress({\n details : options,\n argsList: argsList,\n argsDict: argsDict\n });\n } else {\n // We received final result (progressive or not)\n this._calls[data[1]].onSuccess({\n details : options,\n argsList: argsList,\n argsDict: argsDict\n });\n delete this._calls[data[1]];\n }\n }\n }\n break;\n // case WAMP_MSG_SPEC.REGISTER:\n // // WAMP SPEC:\n // break;\n case WAMP_MSG_SPEC.REGISTERED:\n // WAMP SPEC: [REGISTERED, REGISTER.Request|id, Registration|id]\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received REGISTERED message before session was established');\n } else {\n if (this._requests[data[1]]) {\n this._rpcRegs[this._requests[data[1]].topic] = this._rpcRegs[data[2]] = {\n id : data[2],\n callbacks: [this._requests[data[1]].callbacks.rpc]\n };\n\n this._rpcNames.add(this._requests[data[1]].topic);\n\n if (this._requests[data[1]].callbacks && this._requests[data[1]].callbacks.onSuccess) {\n this._requests[data[1]].callbacks.onSuccess({\n topic : this._requests[data[1]].topic,\n requestId : data[1],\n registrationId: data[2]\n });\n }\n\n delete this._requests[data[1]];\n }\n }\n break;\n // case WAMP_MSG_SPEC.UNREGISTER:\n // // WAMP SPEC:\n // break;\n case WAMP_MSG_SPEC.UNREGISTERED:\n // WAMP SPEC: [UNREGISTERED, UNREGISTER.Request|id]\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received UNREGISTERED message before session was established');\n } else {\n if (this._requests[data[1]]) {\n id = this._rpcRegs[this._requests[data[1]].topic].id;\n delete this._rpcRegs[this._requests[data[1]].topic];\n delete this._rpcRegs[id];\n\n if (this._rpcNames.has(this._requests[data[1]].topic)) {\n this._rpcNames.delete(this._requests[data[1]].topic);\n }\n\n if (this._requests[data[1]].callbacks && this._requests[data[1]].callbacks.onSuccess) {\n this._requests[data[1]].callbacks.onSuccess({\n topic : this._requests[data[1]].topic,\n requestId: data[1]\n });\n }\n\n delete this._requests[data[1]];\n }\n }\n break;\n case WAMP_MSG_SPEC.INVOCATION:\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received INVOCATION message before session was established');\n } else {\n if (this._rpcRegs[data[2]]) {\n let argsList, argsDict, options = data[3];\n\n // WAMP SPEC: [INVOCATION, Request|id, REGISTERED.Registration|id,\n // Details|dict, CALL.Arguments|list, CALL.ArgumentsKw|dict]\n\n let invoke_error_handler = ({ details, error, argsList, argsDict }) => {\n let msg = [WAMP_MSG_SPEC.ERROR, WAMP_MSG_SPEC.INVOCATION,\n data[1], details || {}, error || 'wamp.error.invocation_exception'];\n\n if (argsList && self._isArray(argsList)) {\n msg.push(argsList);\n }\n\n if (argsDict && self._isPlainObject(argsDict)) {\n if (msg.length === 5) {\n msg.push([]);\n }\n msg.push(argsDict);\n }\n self._send(msg);\n },\n invoke_result_handler = results => {\n // WAMP SPEC: [YIELD, INVOCATION.Request|id, Options|dict, (Arguments|list,\n // ArgumentsKw|dict)]\n let msg = [WAMP_MSG_SPEC.YIELD, data[1], {}];\n\n if (self._isPlainObject(results)) {\n\n if (self._isPlainObject(results.options)) {\n let options = results.options;\n\n // Check and handle Payload PassThru Mode\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-passthru-mode\n let pptScheme = results.options.ppt_scheme;\n\n if (pptScheme) {\n if (!this._checkPPTOptions('dealer', results.options)) {\n if (this._cache.opStatus.error && this._cache.opStatus.error instanceof Errors.PPTNotSupportedError) {\n // This case should not happen at all, but for safety\n this._hardClose('wamp.error.protocol_violation', 'Trying to send YIELD in PPT Mode, while Dealer didn\\'t announce it');\n } else {\n invoke_error_handler({\n details : results.options,\n error : this._cache.opStatus.error.message,\n argsList: results.argsList,\n argsDict: results.argsDict\n });\n }\n return;\n }\n\n options.ppt_scheme = pptScheme;\n\n if (results.options.ppt_serializer) {\n options.ppt_serializer = results.options.ppt_serializer;\n }\n if (results.options.ppt_cipher) {\n options.ppt_cipher = results.options.ppt_cipher;\n }\n if (results.options.ppt_keyid) {\n options.ppt_keyid = results.options.ppt_keyid;\n }\n }\n\n msg[2] = options;\n }\n\n }\n\n if (results !== null && typeof (results) !== 'undefined') {\n let res = this._packPPTPayload(results, results.options);\n\n if (res.err) {\n let argsList, argsDict;\n if (!(this._cache.opStatus.error instanceof Errors.PPTSerializationError)) {\n argsList = results.argsList;\n argsDict = results.argsDict;\n }\n invoke_error_handler({\n details : results.options,\n error : this._cache.opStatus.error.message,\n argsList,\n argsDict\n });\n return;\n }\n msg = msg.concat(res.payloadItems);\n }\n\n self._send(msg);\n };\n\n // Check and handle Payload PassThru Mode\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-passthru-mode\n if (options.ppt_scheme) {\n let decodedPayload, pptPayload = data[4][0];\n\n decodedPayload = await this._unpackPPTPayload('dealer', pptPayload, options);\n\n // This case should not happen at all, but for safety\n if (decodedPayload.err && decodedPayload.err instanceof Errors.PPTNotSupportedError) {\n this._log(decodedPayload.err.message);\n this._hardClose('wamp.error.protocol_violation', 'Received INVOCATION in PPT Mode, while Dealer didn\\'t announce it');\n break;\n } else if (decodedPayload.err) {\n\n this._log(decodedPayload.err.message);\n invoke_error_handler({\n details : data[3],\n error : decodedPayload.err.message,\n argsList: data[4],\n argsDict: data[5]\n });\n break;\n }\n\n argsList = decodedPayload.args;\n argsDict = decodedPayload.kwargs;\n\n } else {\n argsList = data[4];\n argsDict = data[5];\n }\n\n p = new Promise((resolve, reject) => {\n resolve(this._rpcRegs[data[2]].callbacks[0]({\n details : options,\n argsList : argsList,\n argsDict : argsDict,\n result_handler: invoke_result_handler,\n error_handler : invoke_error_handler\n }));\n });\n\n p.then((results) => {\n invoke_result_handler(results);\n }).catch(e => {\n invoke_error_handler(e);\n });\n\n } else {\n // WAMP SPEC: [ERROR, INVOCATION, INVOCATION.Request|id, Details|dict, Error|uri]\n this._send([WAMP_MSG_SPEC.ERROR, WAMP_MSG_SPEC.INVOCATION,\n data[1], {}, 'wamp.error.no_such_procedure']);\n this._log(WAMP_ERROR_MSG.NON_EXIST_RPC_INVOCATION);\n }\n }\n break;\n // case WAMP_MSG_SPEC.INTERRUPT:\n // // WAMP SPEC:\n // break;\n // case WAMP_MSG_SPEC.YIELD:\n // // WAMP SPEC:\n // break;\n default:\n this._hardClose('wamp.error.protocol_violation', 'Received non-compliant WAMP message');\n break;\n }\n }\n\n /**\n * Internal websocket on error callback\n * @param {object} error\n * @private\n */\n _wsOnError (error) {\n this._log('websocket error');\n\n if (this._cache.connectPromise) {\n this._cache.connectPromise.onError(error);\n this._cache.connectPromise = null;\n }\n\n if (this._options.onError) {\n this._options.onError({ error });\n }\n }\n\n /**\n * Reconnect to server in case of websocket error\n * @private\n */\n _wsReconnect () {\n this._log('websocket reconnecting...');\n\n if (this._options.onReconnect) {\n this._options.onReconnect();\n }\n\n this._cache.reconnectingAttempts++;\n this._ws = getWebSocket(this._url, this._protocols, this._options.ws,\n this._options.additionalHeaders, this._options.wsRequestOptions);\n this._initWsCallbacks();\n }\n\n /**\n * Resubscribe to topics in case of communication error\n * @private\n */\n _renewSubscriptions () {\n let i;\n const subs = this._subscriptions,\n st = this._subsTopics;\n\n this._subscriptions = {};\n this._subsTopics = new Set();\n\n for (let topic of st) {\n i = subs[topic].callbacks.length;\n while (i--) {\n this.subscribe(topic, subs[topic].callbacks[i], subs[topic].advancedOptions);\n }\n }\n }\n\n /**\n * Reregister RPCs in case of communication error\n * @private\n */\n _renewRegistrations () {\n const rpcs = this._rpcRegs,\n rn = this._rpcNames;\n\n this._rpcRegs = {};\n this._rpcNames = new Set();\n\n for (let rpcName of rn) {\n this.register(rpcName, rpcs[rpcName].callbacks[0]);\n }\n }\n\n /*************************************************************************\n * Wampy public API\n *************************************************************************/\n\n /**\n * Get or set Wampy options\n *\n * To get options - call without parameters\n * To set options - pass hash-table with options values\n *\n * @param {object} [opts]\n * @returns {*}\n */\n options (opts) {\n if (typeof (opts) === 'undefined') {\n return this._options;\n } else if (this._isPlainObject(opts)) {\n this._options = this._merge(this._options, opts);\n return this;\n }\n }\n\n /**\n * Get the status of last operation\n *\n * @returns {object} with 3 fields: code, error, reqId\n * code: 0 - if operation was successful\n * code > 0 - if error occurred\n * error: error instance containing details\n * reqId: last successfully sent request ID\n */\n getOpStatus () {\n return this._cache.opStatus;\n }\n\n /**\n * Get the WAMP Session ID\n *\n * @returns {string} Session ID\n */\n getSessionId () {\n return this._cache.sessionId;\n }\n\n /**\n * Connect to server\n * @param {string} [url] New url (optional)\n * @returns {Promise}\n */\n async connect (url) {\n let error;\n\n if (url) {\n this._url = url;\n }\n\n if (this._options.realm) {\n\n const authOpts = (this._options.authid ? 1 : 0) +\n ((this._isArray(this._options.authmethods) && this._options.authmethods.length) ? 1 : 0) +\n (typeof this._options.onChallenge === 'function' ||\n Object.keys(this._options.authPlugins).length ? 1 : 0);\n\n if (authOpts > 0 && authOpts < 3) {\n error = new Errors.NoCRACallbackOrIdError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n this._setWsProtocols();\n this._ws = getWebSocket(this._url, this._protocols, this._options.ws,\n this._options.additionalHeaders, this._options.wsRequestOptions);\n if (!this._ws) {\n error = new Errors.NoWsOrUrlError();\n this._fillOpStatusByError(error);\n throw error;\n }\n this._initWsCallbacks();\n\n } else {\n error = new Errors.NoRealmError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n let defer = getNewPromise();\n this._cache.connectPromise = defer;\n return defer.promise;\n }\n\n /**\n * Disconnect from server\n * @returns {Promise}\n */\n async disconnect () {\n if (this._cache.sessionId) {\n let defer = getNewPromise();\n this._cache.opStatus = SUCCESS;\n this._cache.closePromise = defer;\n // need to send goodbye message to server\n this._cache.isSayingGoodbye = true;\n this._send([WAMP_MSG_SPEC.GOODBYE, {}, 'wamp.close.system_shutdown']);\n\n return defer.promise;\n\n } else if (this._ws) {\n this._ws.close();\n }\n\n return true;\n }\n\n /**\n * Abort WAMP session establishment\n *\n * @returns {Wampy}\n */\n abort () {\n\n if (!this._cache.sessionId && this._ws.readyState === 1) {\n this._send([WAMP_MSG_SPEC.ABORT, {}, 'wamp.error.abort']);\n this._cache.sessionId = null;\n }\n\n this._ws.close();\n this._cache.opStatus = SUCCESS;\n\n return this;\n }\n\n /**\n * Subscribe to a topic on a broker\n *\n * @param {string} topicURI\n * @param {function} onEvent - received event callback\n * @param {object} [advancedOptions] - optional parameter. Must include any or all of the options:\n * { match: string matching policy (\"prefix\"|\"wildcard\") }\n *\n * @returns {Promise}\n */\n async subscribe (topicURI, onEvent, advancedOptions) {\n let reqId, patternBased = false;\n const options = {}, callbacks = getNewPromise();\n\n if (this._isPlainObject(advancedOptions)) {\n if (Object.prototype.hasOwnProperty.call(advancedOptions, 'match')) {\n if (/prefix|wildcard/.test(advancedOptions.match)) {\n options.match = advancedOptions.match;\n patternBased = true;\n } else {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n }\n } else if (typeof (advancedOptions) !== 'undefined') {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n // Need to be placed here as patternBased flag is determined above\n if (!this._preReqChecks({ topic: topicURI, patternBased: patternBased, allowWAMP: true },\n 'broker')) {\n throw this._cache.opStatus.error;\n }\n\n if (typeof onEvent === 'function') {\n callbacks.onEvent = onEvent;\n } else {\n let error = new Errors.NoCallbackError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n if (!this._subscriptions[topicURI] || !this._subscriptions[topicURI].callbacks.length) {\n // no such subscription or processing unsubscribing\n\n reqId = this._getReqId();\n\n this._requests[reqId] = {\n topic: topicURI,\n callbacks,\n advancedOptions\n };\n\n // WAMP SPEC: [SUBSCRIBE, Request|id, Options|dict, Topic|uri]\n this._send([WAMP_MSG_SPEC.SUBSCRIBE, reqId, options, topicURI]);\n\n } else { // already have subscription to this topic\n // There is no such callback yet\n if (this._subscriptions[topicURI].callbacks.indexOf(callbacks.onEvent) < 0) {\n this._subscriptions[topicURI].callbacks.push(callbacks.onEvent);\n }\n\n return {\n topic: topicURI,\n subscriptionId: this._subscriptions[topicURI].id\n };\n }\n\n this._cache.opStatus = SUCCESS;\n this._cache.opStatus.reqId = reqId;\n return callbacks.promise;\n }\n\n /**\n * Unsubscribe from topic\n * @param {string} topicURI\n * @param {function} [onEvent] - received event callback to remove (optional). If not provided -\n * all callbacks will be removed and unsubscribed on the server\n * @returns {Promise}\n */\n async unsubscribe (topicURI, onEvent) {\n let reqId;\n const callbacks = getNewPromise();\n\n if (!this._preReqChecks(null, 'broker')) {\n throw this._cache.opStatus.error;\n }\n\n if (this._subscriptions[topicURI]) {\n\n reqId = this._getReqId();\n\n if (typeof onEvent === 'function') {\n let i = this._subscriptions[topicURI].callbacks.indexOf(onEvent);\n if (i >= 0) {\n this._subscriptions[topicURI].callbacks.splice(i, 1);\n }\n } else {\n this._subscriptions[topicURI].callbacks = [];\n }\n\n if (this._subscriptions[topicURI].callbacks.length) {\n // There are another callbacks for this topic\n this._cache.opStatus = SUCCESS;\n return true;\n }\n\n this._requests[reqId] = {\n topic: topicURI,\n callbacks\n };\n\n // WAMP_SPEC: [UNSUBSCRIBE, Request|id, SUBSCRIBED.Subscription|id]\n this._send([WAMP_MSG_SPEC.UNSUBSCRIBE, reqId, this._subscriptions[topicURI].id]);\n\n } else {\n let error = new Errors.NonExistUnsubscribeError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n this._cache.opStatus = SUCCESS;\n this._cache.opStatus.reqId = reqId;\n return callbacks.promise;\n }\n\n /**\n * Publish an event to the topic\n * @param {string} topicURI\n * @param {string|number|Array|object} [payload] - can be either a value of any type or null or even omitted.\n * Also, it is possible to pass array and object-like data simultaneously.\n * In this case pass a hash-table with next attributes:\n * {\n * argsList: array payload (may be omitted)\n * argsDict: object payload (may be omitted)\n * }\n * @param {object} [advancedOptions] - optional parameter. Must include any or all of the options:\n * { exclude: integer|array WAMP session id(s) that won't receive a published event,\n * even though they may be subscribed\n * exclude_authid: string|array Authentication id(s) that won't receive\n * a published event, even though they may be subscribed\n * exclude_authrole: string|array Authentication role(s) that won't receive\n * a published event, even though they may be subscribed\n * eligible: integer|array WAMP session id(s) that are allowed\n * to receive a published event\n * eligible_authid: string|array Authentication id(s) that are allowed\n * to receive a published event\n * eligible_authrole: string|array Authentication role(s) that are allowed\n * to receive a published event\n * exclude_me: bool flag of receiving publishing event by initiator\n * disclose_me: bool flag of disclosure of publisher identity (its WAMP session ID)\n * to receivers of a published event }\n * @returns {Promise}\n */\n async publish (topicURI, payload, advancedOptions) {\n let reqId, msg;\n const options = { acknowledge: true }, callbacks = getNewPromise(),\n _optionsConvertHelper = (option, sourceType) => {\n if (advancedOptions[option]) {\n if (this._isArray(advancedOptions[option]) && advancedOptions[option].length) {\n options[option] = advancedOptions[option];\n } else if (typeof advancedOptions[option] === sourceType) {\n options[option] = [advancedOptions[option]];\n } else {\n return false;\n }\n }\n\n return true;\n };\n\n if (!this._preReqChecks({ topic: topicURI, patternBased: false, allowWAMP: false }, 'broker')) {\n throw this._cache.opStatus.error;\n }\n\n if (this._isPlainObject(advancedOptions)) {\n if (!_optionsConvertHelper('exclude', 'number') ||\n !_optionsConvertHelper('exclude_authid', 'string') ||\n !_optionsConvertHelper('exclude_authrole', 'string') ||\n !_optionsConvertHelper('eligible', 'number') ||\n !_optionsConvertHelper('eligible_authid', 'string') ||\n !_optionsConvertHelper('eligible_authrole', 'string')) {\n\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n if (Object.hasOwnProperty.call(advancedOptions, 'exclude_me')) {\n options.exclude_me = advancedOptions.exclude_me !== false;\n }\n\n if (Object.hasOwnProperty.call(advancedOptions, 'disclose_me')) {\n options.disclose_me = advancedOptions.disclose_me === true;\n }\n\n // Check and handle Payload PassThru Mode\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-passthru-mode\n let pptScheme = advancedOptions.ppt_scheme;\n\n if (pptScheme) {\n if (!this._checkPPTOptions('broker', advancedOptions)) {\n throw this._cache.opStatus.error;\n }\n\n options.ppt_scheme = pptScheme;\n\n if (advancedOptions.ppt_serializer) {\n options.ppt_serializer = advancedOptions.ppt_serializer;\n }\n if (advancedOptions.ppt_cipher) {\n options.ppt_cipher = advancedOptions.ppt_cipher;\n }\n if (advancedOptions.ppt_keyid) {\n options.ppt_keyid = advancedOptions.ppt_keyid;\n }\n }\n\n } else if (typeof (advancedOptions) !== 'undefined') {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n reqId = this._getReqId();\n\n this._requests[reqId] = {\n topic: topicURI,\n callbacks\n };\n\n // WAMP_SPEC: [PUBLISH, Request|id, Options|dict, Topic|uri]\n msg = [WAMP_MSG_SPEC.PUBLISH, reqId, options, topicURI];\n\n if (arguments.length > 1) {\n // WAMP_SPEC: [PUBLISH, Request|id, Options|dict, Topic|uri, Arguments|list (, ArgumentsKw|dict)]\n let res = this._packPPTPayload(payload, options);\n\n if (res.err) {\n throw this._cache.opStatus.error;\n }\n msg = msg.concat(res.payloadItems);\n }\n\n this._send(msg);\n this._cache.opStatus = SUCCESS;\n this._cache.opStatus.reqId = reqId;\n return callbacks.promise;\n }\n\n /**\n * Remote Procedure Call\n * @param {string} topicURI\n * @param {string|number|Array|object} [payload] - can be either a value of any type or null. Also, it\n * is possible to pass array and object-like data simultaneously.\n * In this case pass a hash-table with next attributes:\n * {\n * argsList: array payload (may be omitted)\n * argsDict: object payload (may be omitted)\n * }\n * @param {object} [advancedOptions] - optional parameter. Must include any or all of the options:\n * { disclose_me: bool flag of disclosure of Caller identity (WAMP session ID)\n * to endpoints of a routed call\n * progress_callback: function for handling progressive call results\n * timeout: integer timeout (in ms) for the call to finish\n * }\n * @returns {Promise}\n */\n async call (topicURI, payload, advancedOptions) {\n let reqId, msg;\n const options = {}, callbacks = getNewPromise();\n\n if (!this._preReqChecks({ topic: topicURI, patternBased: false, allowWAMP: true }, 'dealer')) {\n throw this._cache.opStatus.error;\n }\n\n if (this._isPlainObject(advancedOptions)) {\n if (Object.hasOwnProperty.call(advancedOptions, 'disclose_me')) {\n options.disclose_me = advancedOptions.disclose_me === true;\n }\n\n if (Object.hasOwnProperty.call(advancedOptions, 'progress_callback')) {\n if (typeof advancedOptions.progress_callback === 'function') {\n options.receive_progress = true;\n callbacks.onProgress = advancedOptions.progress_callback;\n } else {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n }\n\n if (Object.hasOwnProperty.call(advancedOptions, 'timeout')) {\n if (typeof advancedOptions.timeout === 'number') {\n options.timeout = advancedOptions.timeout;\n } else {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n }\n\n // Check and handle Payload PassThru Mode\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-passthru-mode\n let pptScheme = advancedOptions.ppt_scheme;\n\n if (pptScheme) {\n if (!this._checkPPTOptions('dealer', advancedOptions)) {\n throw this._cache.opStatus.error;\n }\n\n options.ppt_scheme = pptScheme;\n\n if (advancedOptions.ppt_serializer) {\n options.ppt_serializer = advancedOptions.ppt_serializer;\n }\n if (advancedOptions.ppt_cipher) {\n options.ppt_cipher = advancedOptions.ppt_cipher;\n }\n if (advancedOptions.ppt_keyid) {\n options.ppt_keyid = advancedOptions.ppt_keyid;\n }\n }\n } else if (typeof (advancedOptions) !== 'undefined') {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n do {\n reqId = this._getReqId();\n } while (reqId in this._calls);\n\n this._calls[reqId] = callbacks;\n\n // WAMP SPEC: [CALL, Request|id, Options|dict, Procedure|uri, (Arguments|list, ArgumentsKw|dict)]\n msg = [WAMP_MSG_SPEC.CALL, reqId, options, topicURI];\n\n if (payload !== null && typeof (payload) !== 'undefined') {\n let res = this._packPPTPayload(payload, options);\n\n if (res.err) {\n throw this._cache.opStatus.error;\n }\n msg = msg.concat(res.payloadItems);\n }\n\n this._send(msg);\n this._cache.opStatus = SUCCESS;\n this._cache.opStatus.reqId = reqId;\n return callbacks.promise;\n }\n\n /**\n * RPC invocation cancelling\n *\n * @param {int} reqId RPC call request ID\n * @param {object} [advancedOptions] - optional parameter. Must include any or all of the options:\n * { mode: string|one of the possible modes:\n * \"skip\" | \"kill\" | \"killnowait\". Skip is default.\n * }\n *\n * @returns {Boolean}\n */\n cancel (reqId, advancedOptions) {\n const options = {};\n\n if (!this._preReqChecks(null, 'dealer')) {\n throw this._cache.opStatus.error;\n }\n\n if (!reqId || !this._calls[reqId]) {\n let error = new Errors.NonExistRPCReqIdError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n if (this._isPlainObject(advancedOptions)) {\n if (Object.hasOwnProperty.call(advancedOptions, 'mode')) {\n if (/skip|kill|killnowait/.test(advancedOptions.mode)) {\n options.mode = advancedOptions.mode;\n } else {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n }\n } else if (typeof (advancedOptions) !== 'undefined') {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n // WAMP SPEC: [CANCEL, CALL.Request|id, Options|dict]\n this._send([WAMP_MSG_SPEC.CANCEL, reqId, options]);\n this._cache.opStatus = SUCCESS;\n this._cache.opStatus.reqId = reqId;\n\n return true;\n }\n\n /**\n * RPC registration for invocation\n * @param {string} topicURI\n * @param {function} rpc - rpc that will receive invocations\n * @param {object} [advancedOptions] - optional parameter. Must include any or all of the options:\n * {\n * match: string matching policy (\"prefix\"|\"wildcard\")\n * invoke: string invocation policy (\"single\"|\"roundrobin\"|\"random\"|\"first\"|\"last\")\n * }\n * @returns {Promise}\n */\n async register (topicURI, rpc, advancedOptions) {\n let reqId, patternBased = false;\n const options = {}, callbacks = getNewPromise();\n\n if (this._isPlainObject(advancedOptions)) {\n if (Object.hasOwnProperty.call(advancedOptions, 'match')) {\n if (/prefix|wildcard/.test(advancedOptions.match)) {\n options.match = advancedOptions.match;\n patternBased = true;\n } else {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n }\n\n if (Object.hasOwnProperty.call(advancedOptions, 'invoke')) {\n if (/single|roundrobin|random|first|last/.test(advancedOptions.invoke)) {\n options.invoke = advancedOptions.invoke;\n } else {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n }\n\n } else if (typeof (advancedOptions) !== 'undefined') {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n // Need to be placed here as patternBased flag is determined above\n if (!this._preReqChecks({ topic: topicURI, patternBased: patternBased, allowWAMP: false },\n 'dealer')) {\n throw this._cache.opStatus.error;\n }\n\n if (typeof rpc === 'function') {\n callbacks.rpc = rpc;\n } else {\n let error = new Errors.NoCallbackError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n if (!this._rpcRegs[topicURI] || !this._rpcRegs[topicURI].callbacks.length) {\n // no such registration or processing unregistering\n\n reqId = this._getReqId();\n\n this._requests[reqId] = {\n topic: topicURI,\n callbacks\n };\n\n // WAMP SPEC: [REGISTER, Request|id, Options|dict, Procedure|uri]\n this._send([WAMP_MSG_SPEC.REGISTER, reqId, options, topicURI]);\n this._cache.opStatus = SUCCESS;\n this._cache.opStatus.reqId = reqId;\n } else { // already have registration with such topicURI\n let error = new Errors.RPCAlreadyRegisteredError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n return callbacks.promise;\n }\n\n /**\n * RPC unregistration for invocation\n * @param {string} topicURI\n * @returns {Promise}\n */\n async unregister (topicURI) {\n let reqId;\n const callbacks = getNewPromise();\n\n if (!this._preReqChecks({ topic: topicURI, patternBased: false, allowWAMP: false }, 'dealer')) {\n throw this._cache.opStatus.error; }\n\n if (this._rpcRegs[topicURI]) { // there is such registration\n\n reqId = this._getReqId();\n\n this._requests[reqId] = {\n topic: topicURI,\n callbacks\n };\n\n // WAMP SPEC: [UNREGISTER, Request|id, REGISTERED.Registration|id]\n this._send([WAMP_MSG_SPEC.UNREGISTER, reqId, this._rpcRegs[topicURI].id]);\n this._cache.opStatus = SUCCESS;\n this._cache.opStatus.reqId = reqId;\n } else { // there is no registration with such topicURI\n let error = new Errors.NonExistRPCUnregistrationError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n return callbacks.promise;\n }\n}\n\nexport default Wampy;\nexport { Wampy, Errors };\n"],"mappings":";;;;;;;AAgBA;;AACA;;;;AACA;;AACA;;;;;;;;;;;;+CAlBA,oJ;;;;;;;;;;;;;;AAmBA,IAAMA,cAAc,GAAG,IAAIC,8BAAJ,EAAvB;AAEA;AACA;AACA;;IACMC,K;EAEF;AACJ;AACA;AACA;AACA;EACI,eAAaC,GAAb,EAAkBC,OAAlB,EAA2B;IAAA;;IAEvB;AACR;AACA;AACA;AACA;IACQ,KAAKC,OAAL,GAAe,QAAf;IAEA;AACR;AACA;AACA;AACA;;IACQ,KAAKC,IAAL,GAAa,OAAOH,GAAP,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,SAFV,GAEsB,IAAA4C,oBAAA,GAFtB;;gBAAA,IAIS,KAAKK,aAAL,CAAmB;kBAAEvJ,KAAK,EAAEoJ,QAAT;kBAAmBnJ,YAAY,EAAE,KAAjC;kBAAwCC,SAAS,EAAE;gBAAnD,CAAnB,EAA+E,QAA/E,CAJT;kBAAA;kBAAA;gBAAA;;gBAAA,MAKc,KAAK9E,MAAL,CAAYK,QAAZ,CAAqBE,KALnC;;cAAA;gBAAA,KAOQ,KAAKY,QAAL,CAAc6M,QAAd,CAPR;kBAAA;kBAAA;gBAAA;;gBAOqC;gBAE7B9N,KAAK,GAAG,KAAKmO,SAAL,EAAR;gBAEA,KAAKvN,SAAL,CAAeZ,KAAf,IAAwB;kBACpB0E,KAAK,EAAEoJ,QADa;kBAEpB9C,SAAS,EAATA;gBAFoB,CAAxB,CAXR,CAgBQ;;gBACA,KAAK7D,KAAL,CAAW,CAACC,wBAAA,CAAc0D,UAAf,EAA2B9K,KAA3B,EAAkC,KAAKiB,QAAL,CAAc6M,QAAd,EAAwB7C,EAA1D,CAAX;;gBACA,KAAKnL,MAAL,CAAYK,QAAZ,GAAuByH,kBAAvB;gBACA,KAAK9H,MAAL,CAAYK,QAAZ,CAAqBH,KAArB,GAA6BA,KAA7B;gBAnBR;gBAAA;;cAAA;gBAoBgB;gBACJK,KArBZ,GAqBoB,IAAIgE,MAAM,CAAC+K,8BAAX,EArBpB;;gBAsBQ,KAAK5K,oBAAL,CAA0BnE,KAA1B;;gBAtBR,MAuBcA,KAvBd;;cAAA;gBAAA,mCA0BW2K,SAAS,CAAC6C,OA1BrB;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;;;;;eA8BW1P,K"} \ No newline at end of file +{"version":3,"file":"wampy.js","names":["jsonSerializer","JsonSerializer","Wampy","url","options","version","_url","_protocols","_wamp_features","agent","roles","publisher","features","subscriber_blackwhite_listing","publisher_exclusion","publisher_identification","payload_passthru_mode","subscriber","pattern_based_subscription","publication_trustlevels","caller","caller_identification","progressive_call_results","call_canceling","call_timeout","callee","call_trustlevels","pattern_based_registration","shared_registration","_cache","sessionId","reqId","server_wamp_features","isSayingGoodbye","opStatus","code","error","timer","reconnectingAttempts","connectPromise","closePromise","_ws","_wsQueue","_requests","_calls","_subscriptions","_subsTopics","Set","_rpcRegs","_rpcNames","_options","debug","logger","autoReconnect","reconnectInterval","maxRetries","realm","helloCustomDetails","uriValidation","authid","authmethods","authextra","authPlugins","authMode","onChallenge","onClose","onError","onReconnect","onReconnectSuccess","ws","additionalHeaders","wsRequestOptions","serializer","payloadSerializers","json","_isPlainObject","_merge","args","console","log","obj","l","length","i","attr","Array","isArray","_isObject","ctor","constructor","prot","prototype","Object","hasOwnProperty","call","toString","protocol","err","topicType","role","Errors","NoDealerError","NoBrokerError","_fillOpStatusByError","_validateURI","topic","patternBased","allowWAMP","UriError","feature","_checkRouterFeature","PPTNotSupportedError","ppt_scheme","search","PPTInvalidSchemeError","E2EE_SERIALIZERS","includes","ppt_serializer","PPTSerializerInvalidError","uri","reBase","rePattern","re","test","indexOf","payload","payloadItems","argsList","argsDict","_isArray","binPayload","pptPayload","kwargs","pptSerializer","encode","e","PPTSerializationError","push","_checkPPTOptions","decode","decodedPayload","msg","_hardClose","errorUri","details","_log","_send","WAMP_MSG_SPEC","ABORT","message","close","_encode","readyState","send","shift","SUCCESS","onopen","_wsOnOpen","onclose","event","_wsOnClose","onmessage","_wsOnMessage","onerror","_wsOnError","serverProtocol","split","NoSerializerAvailableError","isBinary","binaryType","HELLO","setTimeout","_wsReconnect","onSuccess","_resetState","_decode","data","self","WELCOME","CHALLENGE","GOODBYE","ERROR","SUBSCRIBED","UNSUBSCRIBED","PUBLISHED","EVENT","RESULT","REGISTERED","UNREGISTERED","INVOCATION","_renewSubscriptions","_renewRegistrations","p","Promise","resolve","reject","NoCRACallbackOrIdError","then","key","AUTHENTICATE","ChallengeExceptionError","SUBSCRIBE","UNSUBSCRIBE","PUBLISH","REGISTER","UNREGISTER","CALL","callbacks","id","onEvent","advancedOptions","add","requestId","subscriptionId","has","publicationId","_unpackPPTPayload","progress","onProgress","rpc","registrationId","invoke_error_handler","invoke_result_handler","results","YIELD","pptScheme","ppt_cipher","ppt_keyid","res","_packPPTPayload","concat","result_handler","error_handler","WAMP_ERROR_MSG","NON_EXIST_RPC_INVOCATION","getWebSocket","_initWsCallbacks","subs","st","subscribe","rpcs","rn","rpcName","register","opts","authOpts","keys","_setWsProtocols","NoWsOrUrlError","NoRealmError","defer","getNewPromise","promise","topicURI","match","InvalidParamError","_preReqChecks","NoCallbackError","_getReqId","splice","NonExistUnsubscribeError","acknowledge","_optionsConvertHelper","option","sourceType","exclude_me","disclose_me","progress_callback","receive_progress","timeout","NonExistRPCReqIdError","mode","CANCEL","invoke","RPCAlreadyRegisteredError","NonExistRPCUnregistrationError"],"sources":["../src/wampy.js"],"sourcesContent":["/**\n * Project: wampy.js\n *\n * https://github.com/KSDaemon/wampy.js\n *\n * A lightweight client-side implementation of\n * WAMP (The WebSocket Application Messaging Protocol v2)\n * http://wamp.ws\n *\n * Provides asynchronous RPC/PubSub over WebSocket.\n *\n * Copyright 2014 KSDaemon. Licensed under the MIT License.\n * See @license text at http://www.opensource.org/licenses/mit-license.php\n *\n */\n\nimport { WAMP_MSG_SPEC, WAMP_ERROR_MSG, E2EE_SERIALIZERS, SUCCESS } from './constants.js';\nimport * as Errors from './errors.js';\nimport { getWebSocket, getNewPromise } from './utils.js';\nimport { JsonSerializer } from './serializers/JsonSerializer.js';\nconst jsonSerializer = new JsonSerializer();\n\n/**\n * WAMP Client Class\n */\nclass Wampy {\n\n /**\n * Wampy constructor\n * @param {string} [url]\n * @param {Object} [options]\n */\n constructor (url, options) {\n\n /**\n * Wampy version\n * @type {string}\n * @private\n */\n this.version = 'v7.0.0-rc1';\n\n /**\n * WS Url\n * @type {string}\n * @private\n */\n this._url = (typeof url === 'string') ? url : null;\n\n /**\n * WS protocols\n * @type {Array}\n * @private\n */\n this._protocols = ['wamp.2.json'];\n\n /**\n * WAMP features, supported by Wampy\n * @type {object}\n * @private\n */\n this._wamp_features = {\n agent: 'Wampy.js ' + this.version,\n roles: {\n publisher : {\n features: {\n subscriber_blackwhite_listing: true,\n publisher_exclusion : true,\n publisher_identification : true,\n payload_passthru_mode : true\n }\n },\n subscriber: {\n features: {\n pattern_based_subscription: true,\n publication_trustlevels : true,\n publisher_identification : true,\n payload_passthru_mode : true\n }\n },\n caller : {\n features: {\n caller_identification : true,\n progressive_call_results: true,\n call_canceling : true,\n call_timeout : true,\n payload_passthru_mode : true\n }\n },\n callee : {\n features: {\n caller_identification : true,\n call_trustlevels : true,\n pattern_based_registration: true,\n shared_registration : true,\n payload_passthru_mode : true\n\n }\n }\n }\n };\n\n /**\n * Internal cache for object lifetime\n * @type {Object}\n * @private\n */\n this._cache = {\n /**\n * WAMP Session ID\n * @type {string|null}\n */\n sessionId: null,\n\n /**\n * WAMP Session scope requests ID\n * @type {int}\n */\n reqId: 0,\n\n /**\n * Server WAMP roles and features\n */\n server_wamp_features: { roles: {} },\n\n /**\n * Are we in state of saying goodbye\n * @type {boolean}\n */\n isSayingGoodbye: false,\n\n /**\n * Status of last operation\n */\n opStatus: {\n\n /**\n * Int code of last operation\n * @type {int}\n */\n code: 0,\n\n /**\n * Error of last operation (if not was successful)\n * @type {Error}\n */\n error: null,\n\n /**\n * Request ID of last successfully sent operation\n * @type {int}\n */\n reqId: 0\n },\n\n /**\n * Timer for reconnection\n * @type {int|null}\n */\n timer: null,\n\n /**\n * Reconnection attempts\n * @type {number}\n */\n reconnectingAttempts: 0,\n\n /**\n * Promise for onConnect\n */\n connectPromise: null,\n\n /**\n * Promise for onClose\n */\n closePromise: null\n };\n\n /**\n * WebSocket object\n * @type {WebSocket}\n * @private\n */\n this._ws = null;\n\n /**\n * Internal queue for websocket requests, for case of disconnect\n * @type {Array}\n * @private\n */\n this._wsQueue = [];\n\n /**\n * Internal queue for wamp requests\n * @type {object}\n * @private\n */\n this._requests = {};\n\n /**\n * Stored RPC\n * @type {object}\n * @private\n */\n this._calls = {};\n\n /**\n * Stored Pub/Sub\n * @type {object}\n * @private\n */\n this._subscriptions = {};\n\n /**\n * Stored Pub/Sub topics\n * @type {Set}\n * @private\n */\n this._subsTopics = new Set();\n\n /**\n * Stored RPC Registrations\n * @type {object}\n * @private\n */\n this._rpcRegs = {};\n\n /**\n * Stored RPC names\n * @type {Set}\n * @private\n */\n this._rpcNames = new Set();\n\n /**\n * Options hash-table\n * @type {Object}\n * @private\n */\n this._options = {\n /**\n * Logging\n * @type {boolean}\n */\n debug: false,\n\n /**\n * Logger\n * @type {function}\n */\n logger: null,\n\n /**\n * Reconnecting flag\n * @type {boolean}\n */\n autoReconnect: true,\n\n /**\n * Reconnecting interval (in ms)\n * @type {number}\n */\n reconnectInterval: 2 * 1000,\n\n /**\n * Maximum reconnection retries\n * @type {number}\n */\n maxRetries: 25,\n\n /**\n * WAMP Realm to join\n * @type {string|null}\n */\n realm: null,\n\n /**\n * Custom attributes to send to router on hello\n * @type {object}\n */\n helloCustomDetails: null,\n\n /**\n * Validation of the topic URI structure\n * @type {string} - strict or loose\n */\n uriValidation: 'strict',\n\n /**\n * Authentication id to use in challenge\n * @type {string|null}\n */\n authid: null,\n\n /**\n * Supported authentication methods\n * @type {array}\n */\n authmethods: [],\n\n /**\n * Additional authentication options (used in WAMP CryptoSign for example)\n * @type {object}\n */\n authextra: {},\n\n /**\n * Authentication helpers for processing different authmethods challenge flows\n * @type {object}\n */\n authPlugins: {},\n\n /**\n * Mode of authorization flow\n * Possible values: manual | auto\n * @type {string}\n */\n authMode: 'manual',\n\n /**\n * onChallenge callback\n * @type {function}\n */\n onChallenge: null,\n\n /**\n * onClose callback\n * @type {function}\n */\n onClose: null,\n\n /**\n * onError callback\n * @type {function}\n */\n onError: null,\n\n /**\n * onReconnect callback\n * @type {function}\n */\n onReconnect: null,\n\n /**\n * onReconnectSuccess callback\n * @type {function}\n */\n onReconnectSuccess: null,\n\n /**\n * User provided WebSocket class\n * @type {function}\n */\n ws: null,\n\n /**\n * User provided additional HTTP headers (for use in Node.js enviroment)\n * @type {object}\n */\n additionalHeaders: null,\n\n /**\n * User provided WS Client Config Options (for use in Node.js enviroment)\n * @type {object}\n */\n wsRequestOptions: null,\n\n /**\n * User provided Serializer class\n * @type {object}\n */\n serializer: jsonSerializer,\n\n /**\n * User provided Serializers for Payload Passthru Mode\n * @type {object}\n */\n payloadSerializers: {\n json: jsonSerializer\n }\n };\n\n if (this._isPlainObject(options)) {\n this._options = this._merge(this._options, options);\n } else if (this._isPlainObject(url)) {\n this._options = this._merge(this._options, url);\n }\n\n }\n\n /* Internal utils methods */\n /**\n * Internal logger\n * @private\n */\n _log (...args) {\n if (this._options.debug) {\n if (this._options.logger) {\n this._options.logger(args);\n } else {\n console.log('[wampy]', args);\n }\n }\n }\n\n /**\n * Get the new unique request id\n * @returns {number}\n * @private\n */\n _getReqId () {\n return ++this._cache.reqId;\n }\n\n /**\n * Merge argument objects into one\n * @returns {Object}\n * @private\n */\n _merge (...args) {\n const obj = {}, l = args.length;\n let i, attr;\n\n for (i = 0; i < l; i++) {\n for (attr in args[i]) {\n obj[attr] = args[i][attr];\n }\n }\n return obj;\n }\n\n /**\n * Check if value is array\n * @param obj\n * @returns {boolean}\n * @private\n */\n _isArray (obj) {\n return (!!obj) && (Array.isArray(obj));\n }\n\n /**\n * Check if value is object literal\n * @param obj\n * @returns {boolean}\n * @private\n */\n _isPlainObject (obj) {\n if (!this._isObject(obj)) {\n return false;\n }\n\n // If obj has modified constructor\n const ctor = obj.constructor;\n if (typeof ctor !== 'function') {\n return false;\n }\n\n // If obj has modified prototype\n const prot = ctor.prototype;\n if (this._isObject(prot) === false) {\n return false;\n }\n\n // If constructor does not have an Object-specific method\n return Object.hasOwnProperty.call(prot, 'isPrototypeOf') !== false;\n }\n\n /**\n * Check if value is an object\n * @param obj\n * @returns {boolean}\n * @private\n */\n _isObject (obj) {\n return obj !== null\n && typeof obj === 'object'\n && Array.isArray(obj) === false\n && Object.prototype.toString.call(obj) === '[object Object]';\n }\n\n /**\n * Set websocket protocol based on options\n * @private\n */\n _setWsProtocols () {\n this._protocols = ['wamp.2.' + this._options.serializer.protocol];\n }\n\n /**\n * Fill instance operation status\n * @param {Error} err\n * @private\n */\n _fillOpStatusByError (err) {\n this._cache.opStatus = {\n code: err.code,\n error: err,\n reqId: 0\n };\n }\n\n /**\n * Prerequisite checks for any wampy api call\n * @param {object} topicType { topic: URI, patternBased: true|false, allowWAMP: true|false }\n * @param {string} role\n * @returns {boolean}\n * @private\n */\n _preReqChecks (topicType, role) {\n let err;\n\n if (this._cache.sessionId && !this._cache.server_wamp_features.roles[role]) {\n switch (role) {\n case 'dealer':\n err = new Errors.NoDealerError();\n break;\n case 'broker':\n err = new Errors.NoBrokerError();\n break;\n }\n this._fillOpStatusByError(err);\n return false;\n }\n\n if (topicType && !this._validateURI(topicType.topic, topicType.patternBased, topicType.allowWAMP)) {\n this._fillOpStatusByError(new Errors.UriError());\n return false;\n }\n\n return true;\n }\n\n /**\n * Check for specified feature in a role of connected WAMP Router\n * @param {string} role\n * @param {string} feature\n * @returns {boolean}\n * @private\n */\n _checkRouterFeature (role, feature) {\n return this._cache.server_wamp_features.roles[role].features[feature] === true;\n }\n\n /**\n * Check for PPT mode options correctness\n * @param {string} role WAMP Router Role to check support\n * @param {object} options\n * @returns {boolean}\n * @private\n */\n _checkPPTOptions (role, options) {\n if (!this._checkRouterFeature(role, 'payload_passthru_mode')) {\n this._fillOpStatusByError(new Errors.PPTNotSupportedError());\n return false;\n }\n\n if (options.ppt_scheme.search(/^(wamp$|mqtt$|x_)/) < 0) {\n this._fillOpStatusByError(new Errors.PPTInvalidSchemeError());\n return false;\n }\n\n if (options.ppt_scheme === 'wamp' && !E2EE_SERIALIZERS.includes(options.ppt_serializer)) {\n this._fillOpStatusByError(new Errors.PPTSerializerInvalidError());\n return false;\n }\n\n return true;\n }\n\n /**\n * Validate uri\n * @param {string} uri\n * @param {boolean} patternBased\n * @param {boolean} allowWAMP\n * @returns {boolean}\n * @private\n */\n _validateURI (uri, patternBased, allowWAMP) {\n let reBase;\n let rePattern;\n\n if (this._options.uriValidation === 'strict') {\n reBase = /^([0-9a-zA-Z_]+\\.)*([0-9a-zA-Z_]+)$/;\n rePattern = /^([0-9a-zA-Z_]+\\.{1,2})*([0-9a-zA-Z_]+)$/;\n } else if (this._options.uriValidation === 'loose') {\n reBase = /^([^\\s.#]+\\.)*([^\\s.#]+)$/;\n rePattern = /^([^\\s.#]+\\.{1,2})*([^\\s.#]+)$/;\n } else {\n return false;\n }\n const re = patternBased ? rePattern : reBase;\n\n if (allowWAMP) {\n return re.test(uri);\n } else {\n return !(!re.test(uri) || uri.indexOf('wamp.') === 0);\n }\n }\n\n /**\n * Prepares PPT/E2EE payload for adding to WAMP message\n * @param {string|number|Array|object} payload\n * @param {Object} options\n * @returns {Object}\n * @private\n */\n _packPPTPayload (payload, options) {\n let payloadItems = [], err = false, argsList, argsDict;\n\n if (this._isArray(payload)) {\n argsList = payload;\n } else if (this._isPlainObject(payload)) {\n // It's a wampy unified form of payload passing\n if (payload.argsList || payload.argsDict) {\n if (this._isArray(payload.argsList)) {\n argsList = payload.argsList;\n } else if (typeof (payload.argsList) !== 'undefined') {\n argsList = [payload.argsList];\n }\n\n if (payload.argsDict) {\n argsDict = payload.argsDict;\n }\n } else {\n argsDict = payload;\n }\n } else { // assume it's a single value\n argsList = [payload];\n }\n\n // Check and handle Payload PassThru Mode\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-passthru-mode\n if (options.ppt_scheme) {\n let binPayload, pptPayload = { args: argsList, kwargs: argsDict };\n\n if (options.ppt_serializer && options.ppt_serializer !== 'native') {\n let pptSerializer = this._options.payloadSerializers[options.ppt_serializer];\n\n if (!pptSerializer) {\n err = true;\n this._fillOpStatusByError(new Errors.PPTSerializerInvalidError());\n return { err, payloadItems };\n }\n\n try {\n binPayload = pptSerializer.encode(pptPayload);\n } catch (e) {\n err = true;\n this._fillOpStatusByError(new Errors.PPTSerializationError());\n return { err, payloadItems };\n }\n } else {\n binPayload = pptPayload;\n }\n\n // wamp scheme means Payload End-to-End Encryption\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-end-to-end-encrypti\n if (options.ppt_scheme === 'wamp') {\n\n // TODO: implement End-to-End Encryption\n }\n\n payloadItems.push([binPayload]);\n\n } else {\n if (argsList) {\n payloadItems.push(argsList);\n }\n if (argsDict) {\n if (!argsList) {\n payloadItems.push([]);\n }\n payloadItems.push(argsDict);\n }\n }\n\n return { err, payloadItems };\n }\n\n /**\n * Unpack PPT/E2EE payload to common\n * @param {string} role\n * @param {Array} pptPayload\n * @param {Object} options\n * @returns {Object}\n * @private\n */\n async _unpackPPTPayload (role, pptPayload, options) {\n let err = false, decodedPayload;\n\n if (!this._checkPPTOptions(role, options)) {\n return { err: this._cache.opStatus.error };\n }\n\n // wamp scheme means Payload End-to-End Encryption\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-end-to-end-encrypti\n if (options.ppt_scheme === 'wamp') {\n\n // TODO: implement End-to-End Encryption\n\n }\n\n if (options.ppt_serializer && options.ppt_serializer !== 'native') {\n let pptSerializer = this._options.payloadSerializers[options.ppt_serializer];\n\n if (!pptSerializer) {\n return { err: new Errors.PPTSerializerInvalidError() };\n }\n\n try {\n decodedPayload = await pptSerializer.decode(pptPayload);\n } catch (e) {\n return { err: new Errors.PPTSerializationError() };\n }\n } else {\n decodedPayload = pptPayload;\n }\n return { err, args: decodedPayload.args, kwargs: decodedPayload.kwargs };\n }\n\n /**\n * Encode WAMP message\n * @param {Array} msg\n * @returns {*}\n * @private\n */\n _encode (msg) {\n try {\n return this._options.serializer.encode(msg);\n } catch (e) {\n this._hardClose('wamp.error.protocol_violation', 'Can not encode message');\n }\n }\n\n /**\n * Decode WAMP message\n * @param msg\n * @returns {Promise}\n * @private\n */\n _decode (msg) {\n return this._options.serializer.decode(msg);\n }\n\n /**\n * Hard close of connection due to protocol violations\n * @param {string} errorUri\n * @param {string} details\n * @private\n */\n _hardClose (errorUri, details) {\n this._log(details);\n // Cleanup outgoing message queue\n this._wsQueue = [];\n this._send([WAMP_MSG_SPEC.ABORT, { message: details }, errorUri]);\n\n // In case we were just making first connection\n if (this._cache.connectPromise) {\n this._cache.connectPromise.onError(errorUri);\n this._cache.connectPromise = null;\n }\n\n if (this._options.onError) {\n this._options.onError({ error: errorUri, details: details });\n }\n\n this._ws.close();\n }\n\n /**\n * Send encoded message to server\n * @param {Array} [msg]\n * @private\n */\n _send (msg) {\n if (msg) {\n this._wsQueue.push(this._encode(msg));\n }\n\n if (this._ws && this._ws.readyState === 1 && this._cache.sessionId) {\n while (this._wsQueue.length) {\n this._ws.send(this._wsQueue.shift());\n }\n }\n }\n\n /**\n * Reset internal state and cache\n * @private\n */\n _resetState () {\n this._wsQueue = [];\n this._subscriptions = {};\n this._subsTopics = new Set();\n this._requests = {};\n this._calls = {};\n this._rpcRegs = {};\n this._rpcNames = new Set();\n\n // Just keep attrs that are have to be present\n this._cache = {\n reqId : 0,\n reconnectingAttempts: 0,\n opStatus : SUCCESS,\n closePromise : null,\n connectPromise : null,\n };\n }\n\n /**\n * Initialize internal websocket callbacks\n * @private\n */\n _initWsCallbacks () {\n if (this._ws) {\n this._ws.onopen = () => {\n this._wsOnOpen();\n };\n this._ws.onclose = event => {\n this._wsOnClose(event);\n };\n this._ws.onmessage = event => {\n this._wsOnMessage(event);\n };\n this._ws.onerror = error => {\n this._wsOnError(error);\n };\n }\n }\n\n /**\n * Internal websocket on open callback\n * @private\n */\n _wsOnOpen () {\n const options = this._merge(this._options.helloCustomDetails, this._wamp_features),\n serverProtocol = this._ws.protocol ? this._ws.protocol.split('.')[2] : '';\n if (this._options.authid) {\n options.authmethods = this._options.authmethods;\n options.authid = this._options.authid;\n options.authextra = this._options.authextra;\n }\n\n this._log('websocket connected');\n\n if (this._options.serializer.protocol !== serverProtocol) {\n // Server have chosen not our preferred protocol\n\n // Falling back to json if possible\n // Temp hack for React Native Environment is removed as\n // (facebook/react-native#24796) was resolved\n if (serverProtocol === 'json') {\n this._options.serializer = new JsonSerializer();\n } else {\n this._fillOpStatusByError(new Errors.NoSerializerAvailableError());\n return this;\n }\n\n }\n\n if (this._options.serializer.isBinary) {\n this._ws.binaryType = 'arraybuffer';\n }\n\n // WAMP SPEC: [HELLO, Realm|uri, Details|dict]\n // Sending directly 'cause it's a hello msg and no sessionId check is needed\n this._ws.send(this._encode([WAMP_MSG_SPEC.HELLO, this._options.realm, options]));\n }\n\n /**\n * Internal websocket on close callback\n * @param {object} event\n * @private\n */\n _wsOnClose (event) {\n this._log('websocket disconnected. Info: ', event);\n\n // Automatic reconnection\n if ((this._cache.sessionId || this._cache.reconnectingAttempts) &&\n this._options.autoReconnect &&\n (this._options.maxRetries === 0 ||\n this._cache.reconnectingAttempts < this._options.maxRetries) &&\n !this._cache.isSayingGoodbye) {\n this._cache.sessionId = null;\n this._cache.timer = setTimeout(() => {\n this._wsReconnect();\n }, this._options.reconnectInterval);\n } else {\n // No reconnection needed or reached max retries count\n if (this._options.onClose) {\n this._options.onClose();\n } else if (this._cache.closePromise) {\n this._cache.closePromise.onSuccess();\n this._cache.closePromise = null;\n }\n this._resetState();\n this._ws = null;\n }\n }\n\n /**\n * Internal websocket on event callback\n * @param {object} event\n * @private\n */\n async _wsOnMessage (event) {\n let data;\n try {\n data = await this._decode(event.data);\n } catch (e) {\n this._hardClose('wamp.error.protocol_violation', 'Can not decode received message');\n }\n\n this._log('websocket message received: ', data);\n\n let id, i, p, self = this;\n\n switch (data[0]) {\n case WAMP_MSG_SPEC.WELCOME:\n // WAMP SPEC: [WELCOME, Session|id, Details|dict]\n if (this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received WELCOME message after session was established');\n } else {\n this._cache.sessionId = data[1];\n this._cache.server_wamp_features = data[2];\n\n if (this._cache.reconnectingAttempts) {\n // There was reconnection\n\n this._cache.reconnectingAttempts = 0;\n\n if (this._options.onReconnectSuccess) {\n this._options.onReconnectSuccess(data[2]);\n }\n\n // Let's renew all previous state\n this._renewSubscriptions();\n this._renewRegistrations();\n\n } else {\n // Firing onConnect event on real connection to WAMP server\n this._cache.connectPromise.onSuccess(data[2]);\n this._cache.connectPromise = null;\n }\n\n // Send local queue if there is something out there\n this._send();\n }\n break;\n case WAMP_MSG_SPEC.ABORT:\n // WAMP SPEC: [ABORT, Details|dict, Reason|uri]\n if (this._options.onError) {\n this._options.onError({ error: data[2], details: data[1] });\n }\n this._ws.close();\n break;\n case WAMP_MSG_SPEC.CHALLENGE:\n // WAMP SPEC: [CHALLENGE, AuthMethod|string, Extra|dict]\n if (this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received CHALLENGE message after session was established');\n break;\n } else if (this._options.authid &&\n this._options.authMode === 'manual' &&\n typeof this._options.onChallenge === 'function') {\n\n p = new Promise((resolve, reject) => {\n resolve(this._options.onChallenge(data[1], data[2]));\n });\n\n } else if (this._options.authid &&\n this._options.authMode === 'auto' &&\n typeof this._options.authPlugins[data[1]] === 'function') {\n\n p = new Promise((resolve, reject) => {\n resolve(this._options.authPlugins[data[1]](data[1], data[2]));\n });\n\n } else {\n let error = new Errors.NoCRACallbackOrIdError();\n\n this._ws.send(this._encode([\n WAMP_MSG_SPEC.ABORT,\n { message: error.message },\n 'wamp.error.cannot_authenticate'\n ]));\n if (this._options.onError) {\n this._options.onError({ error });\n }\n this._ws.close();\n this._fillOpStatusByError(error);\n break;\n }\n\n p.then((key) => {\n\n // Sending directly 'cause it's a challenge msg and no sessionId check is needed\n this._ws.send(this._encode([WAMP_MSG_SPEC.AUTHENTICATE, key, {}]));\n\n }).catch(e => {\n let error = new Errors.ChallengeExceptionError();\n\n this._ws.send(this._encode([\n WAMP_MSG_SPEC.ABORT,\n { message: error.message },\n 'wamp.error.cannot_authenticate'\n ]));\n if (this._options.onError) {\n this._options.onError({ error });\n }\n this._ws.close();\n this._fillOpStatusByError(error);\n });\n\n break;\n case WAMP_MSG_SPEC.GOODBYE:\n // WAMP SPEC: [GOODBYE, Details|dict, Reason|uri]\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received GOODBYE message before session was established');\n } else {\n if (!this._cache.isSayingGoodbye) { // get goodbye, initiated by server\n this._cache.isSayingGoodbye = true;\n this._send([WAMP_MSG_SPEC.GOODBYE, {}, 'wamp.close.goodbye_and_out']);\n }\n this._cache.sessionId = null;\n this._ws.close();\n }\n break;\n case WAMP_MSG_SPEC.ERROR:\n // WAMP SPEC: [ERROR, REQUEST.Type|int, REQUEST.Request|id, Details|dict,\n // Error|uri, (Arguments|list, ArgumentsKw|dict)]\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received ERROR message before session was established');\n } else {\n switch (data[1]) {\n case WAMP_MSG_SPEC.SUBSCRIBE:\n case WAMP_MSG_SPEC.UNSUBSCRIBE:\n case WAMP_MSG_SPEC.PUBLISH:\n case WAMP_MSG_SPEC.REGISTER:\n case WAMP_MSG_SPEC.UNREGISTER:\n\n this._requests[data[2]] && this._requests[data[2]].callbacks.onError &&\n this._requests[data[2]].callbacks.onError({\n error : data[4],\n details : data[3],\n argsList: data[5],\n argsDict: data[6]\n });\n delete this._requests[data[2]];\n\n break;\n // case WAMP_MSG_SPEC.INVOCATION:\n // break;\n case WAMP_MSG_SPEC.CALL:\n\n // WAMP SPEC: [ERROR, CALL, CALL.Request|id, Details|dict,\n // Error|uri, Arguments|list, ArgumentsKw|dict]\n this._calls[data[2]] && this._calls[data[2]].onError &&\n this._calls[data[2]].onError({\n error : data[4],\n details : data[3],\n argsList: data[5],\n argsDict: data[6]\n });\n delete this._calls[data[2]];\n\n break;\n default:\n this._hardClose('wamp.error.protocol_violation', 'Received invalid ERROR message');\n break;\n }\n }\n break;\n case WAMP_MSG_SPEC.SUBSCRIBED:\n // WAMP SPEC: [SUBSCRIBED, SUBSCRIBE.Request|id, Subscription|id]\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received SUBSCRIBED message before session was established');\n } else {\n if (this._requests[data[1]]) {\n this._subscriptions[this._requests[data[1]].topic] = this._subscriptions[data[2]] = {\n id : data[2],\n callbacks : [this._requests[data[1]].callbacks.onEvent],\n advancedOptions: this._requests[data[1]].advancedOptions\n };\n\n this._subsTopics.add(this._requests[data[1]].topic);\n\n if (this._requests[data[1]].callbacks.onSuccess) {\n this._requests[data[1]].callbacks.onSuccess({\n topic : this._requests[data[1]].topic,\n requestId : data[1],\n subscriptionId: data[2]\n });\n }\n\n delete this._requests[data[1]];\n\n }\n }\n break;\n case WAMP_MSG_SPEC.UNSUBSCRIBED:\n // WAMP SPEC: [UNSUBSCRIBED, UNSUBSCRIBE.Request|id]\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received UNSUBSCRIBED message before session was established');\n } else {\n if (this._requests[data[1]]) {\n id = this._subscriptions[this._requests[data[1]].topic].id;\n delete this._subscriptions[this._requests[data[1]].topic];\n delete this._subscriptions[id];\n\n if (this._subsTopics.has(this._requests[data[1]].topic)) {\n this._subsTopics.delete(this._requests[data[1]].topic);\n }\n\n if (this._requests[data[1]].callbacks.onSuccess) {\n this._requests[data[1]].callbacks.onSuccess({\n topic : this._requests[data[1]].topic,\n requestId: data[1]\n });\n }\n\n delete this._requests[data[1]];\n }\n }\n break;\n case WAMP_MSG_SPEC.PUBLISHED:\n // WAMP SPEC: [PUBLISHED, PUBLISH.Request|id, Publication|id]\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received PUBLISHED message before session was established');\n } else {\n if (this._requests[data[1]]) {\n if (this._requests[data[1]].callbacks && this._requests[data[1]].callbacks.onSuccess) {\n this._requests[data[1]].callbacks.onSuccess({\n topic : this._requests[data[1]].topic,\n requestId : data[1],\n publicationId: data[2]\n });\n }\n\n delete this._requests[data[1]];\n }\n }\n break;\n case WAMP_MSG_SPEC.EVENT:\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received EVENT message before session was established');\n } else {\n if (this._subscriptions[data[1]]) {\n let argsList, argsDict, options = data[3];\n\n // WAMP SPEC: [EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id,\n // Details|dict, PUBLISH.Arguments|list, PUBLISH.ArgumentKw|dict]\n\n // Check and handle Payload PassThru Mode\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-passthru-mode\n if (options.ppt_scheme) {\n let decodedPayload, pptPayload = data[4][0];\n\n decodedPayload = await this._unpackPPTPayload('broker', pptPayload, options);\n\n if (decodedPayload.err) {\n // Since it is async publication, and no link to\n // original publication - as it was already published\n // we can not reply with error, only log it.\n // Although the router should handle it\n this._log(decodedPayload.err.message);\n break;\n }\n\n argsList = decodedPayload.args;\n argsDict = decodedPayload.kwargs;\n\n } else {\n argsList = data[4];\n argsDict = data[5];\n }\n\n i = this._subscriptions[data[1]].callbacks.length;\n while (i--) {\n this._subscriptions[data[1]].callbacks[i]({\n details : options,\n argsList: argsList,\n argsDict: argsDict\n });\n }\n }\n }\n break;\n case WAMP_MSG_SPEC.RESULT:\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received RESULT message before session was established');\n } else {\n if (this._calls[data[1]]) {\n let argsList, argsDict, options = data[2];\n\n // WAMP SPEC: [RESULT, CALL.Request|id, Details|dict,\n // YIELD.Arguments|list, YIELD.ArgumentsKw|dict]\n\n // Check and handle Payload PassThru Mode\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-passthru-mode\n if (options.ppt_scheme) {\n let decodedPayload, pptPayload = data[3][0];\n\n decodedPayload = await this._unpackPPTPayload('dealer', pptPayload, options);\n\n if (decodedPayload.err) {\n this._log(decodedPayload.err.message);\n this._cache.opStatus = decodedPayload.err;\n this._calls[data[1]].onError({\n error : decodedPayload.err.message,\n details : data[2],\n argsList: data[3],\n argsDict: data[4]\n });\n delete this._calls[data[1]];\n break;\n }\n\n argsList = decodedPayload.args;\n argsDict = decodedPayload.kwargs;\n\n } else {\n argsList = data[3];\n argsDict = data[4];\n }\n\n if (options.progress === true) {\n this._calls[data[1]].onProgress({\n details : options,\n argsList: argsList,\n argsDict: argsDict\n });\n } else {\n // We received final result (progressive or not)\n this._calls[data[1]].onSuccess({\n details : options,\n argsList: argsList,\n argsDict: argsDict\n });\n delete this._calls[data[1]];\n }\n }\n }\n break;\n // case WAMP_MSG_SPEC.REGISTER:\n // // WAMP SPEC:\n // break;\n case WAMP_MSG_SPEC.REGISTERED:\n // WAMP SPEC: [REGISTERED, REGISTER.Request|id, Registration|id]\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received REGISTERED message before session was established');\n } else {\n if (this._requests[data[1]]) {\n this._rpcRegs[this._requests[data[1]].topic] = this._rpcRegs[data[2]] = {\n id : data[2],\n callbacks: [this._requests[data[1]].callbacks.rpc]\n };\n\n this._rpcNames.add(this._requests[data[1]].topic);\n\n if (this._requests[data[1]].callbacks && this._requests[data[1]].callbacks.onSuccess) {\n this._requests[data[1]].callbacks.onSuccess({\n topic : this._requests[data[1]].topic,\n requestId : data[1],\n registrationId: data[2]\n });\n }\n\n delete this._requests[data[1]];\n }\n }\n break;\n // case WAMP_MSG_SPEC.UNREGISTER:\n // // WAMP SPEC:\n // break;\n case WAMP_MSG_SPEC.UNREGISTERED:\n // WAMP SPEC: [UNREGISTERED, UNREGISTER.Request|id]\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received UNREGISTERED message before session was established');\n } else {\n if (this._requests[data[1]]) {\n id = this._rpcRegs[this._requests[data[1]].topic].id;\n delete this._rpcRegs[this._requests[data[1]].topic];\n delete this._rpcRegs[id];\n\n if (this._rpcNames.has(this._requests[data[1]].topic)) {\n this._rpcNames.delete(this._requests[data[1]].topic);\n }\n\n if (this._requests[data[1]].callbacks && this._requests[data[1]].callbacks.onSuccess) {\n this._requests[data[1]].callbacks.onSuccess({\n topic : this._requests[data[1]].topic,\n requestId: data[1]\n });\n }\n\n delete this._requests[data[1]];\n }\n }\n break;\n case WAMP_MSG_SPEC.INVOCATION:\n if (!this._cache.sessionId) {\n this._hardClose('wamp.error.protocol_violation',\n 'Received INVOCATION message before session was established');\n } else {\n if (this._rpcRegs[data[2]]) {\n let argsList, argsDict, options = data[3];\n\n // WAMP SPEC: [INVOCATION, Request|id, REGISTERED.Registration|id,\n // Details|dict, CALL.Arguments|list, CALL.ArgumentsKw|dict]\n\n let invoke_error_handler = ({ details, error, argsList, argsDict }) => {\n let msg = [WAMP_MSG_SPEC.ERROR, WAMP_MSG_SPEC.INVOCATION,\n data[1], details || {}, error || 'wamp.error.invocation_exception'];\n\n if (argsList && self._isArray(argsList)) {\n msg.push(argsList);\n }\n\n if (argsDict && self._isPlainObject(argsDict)) {\n if (msg.length === 5) {\n msg.push([]);\n }\n msg.push(argsDict);\n }\n self._send(msg);\n },\n invoke_result_handler = results => {\n // WAMP SPEC: [YIELD, INVOCATION.Request|id, Options|dict, (Arguments|list,\n // ArgumentsKw|dict)]\n let msg = [WAMP_MSG_SPEC.YIELD, data[1], {}];\n\n if (self._isPlainObject(results)) {\n\n if (self._isPlainObject(results.options)) {\n let options = results.options;\n\n // Check and handle Payload PassThru Mode\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-passthru-mode\n let pptScheme = results.options.ppt_scheme;\n\n if (pptScheme) {\n if (!this._checkPPTOptions('dealer', results.options)) {\n if (this._cache.opStatus.error && this._cache.opStatus.error instanceof Errors.PPTNotSupportedError) {\n // This case should not happen at all, but for safety\n this._hardClose('wamp.error.protocol_violation', 'Trying to send YIELD in PPT Mode, while Dealer didn\\'t announce it');\n } else {\n invoke_error_handler({\n details : results.options,\n error : this._cache.opStatus.error.message,\n argsList: results.argsList,\n argsDict: results.argsDict\n });\n }\n return;\n }\n\n options.ppt_scheme = pptScheme;\n\n if (results.options.ppt_serializer) {\n options.ppt_serializer = results.options.ppt_serializer;\n }\n if (results.options.ppt_cipher) {\n options.ppt_cipher = results.options.ppt_cipher;\n }\n if (results.options.ppt_keyid) {\n options.ppt_keyid = results.options.ppt_keyid;\n }\n }\n\n msg[2] = options;\n }\n\n }\n\n if (results !== null && typeof (results) !== 'undefined') {\n let res = this._packPPTPayload(results, results.options);\n\n if (res.err) {\n let argsList, argsDict;\n if (!(this._cache.opStatus.error instanceof Errors.PPTSerializationError)) {\n argsList = results.argsList;\n argsDict = results.argsDict;\n }\n invoke_error_handler({\n details : results.options,\n error : this._cache.opStatus.error.message,\n argsList,\n argsDict\n });\n return;\n }\n msg = msg.concat(res.payloadItems);\n }\n\n self._send(msg);\n };\n\n // Check and handle Payload PassThru Mode\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-passthru-mode\n if (options.ppt_scheme) {\n let decodedPayload, pptPayload = data[4][0];\n\n decodedPayload = await this._unpackPPTPayload('dealer', pptPayload, options);\n\n // This case should not happen at all, but for safety\n if (decodedPayload.err && decodedPayload.err instanceof Errors.PPTNotSupportedError) {\n this._log(decodedPayload.err.message);\n this._hardClose('wamp.error.protocol_violation', 'Received INVOCATION in PPT Mode, while Dealer didn\\'t announce it');\n break;\n } else if (decodedPayload.err) {\n\n this._log(decodedPayload.err.message);\n invoke_error_handler({\n details : data[3],\n error : decodedPayload.err.message,\n argsList: data[4],\n argsDict: data[5]\n });\n break;\n }\n\n argsList = decodedPayload.args;\n argsDict = decodedPayload.kwargs;\n\n } else {\n argsList = data[4];\n argsDict = data[5];\n }\n\n p = new Promise((resolve, reject) => {\n resolve(this._rpcRegs[data[2]].callbacks[0]({\n details : options,\n argsList : argsList,\n argsDict : argsDict,\n result_handler: invoke_result_handler,\n error_handler : invoke_error_handler\n }));\n });\n\n p.then((results) => {\n invoke_result_handler(results);\n }).catch(e => {\n invoke_error_handler(e);\n });\n\n } else {\n // WAMP SPEC: [ERROR, INVOCATION, INVOCATION.Request|id, Details|dict, Error|uri]\n this._send([WAMP_MSG_SPEC.ERROR, WAMP_MSG_SPEC.INVOCATION,\n data[1], {}, 'wamp.error.no_such_procedure']);\n this._log(WAMP_ERROR_MSG.NON_EXIST_RPC_INVOCATION);\n }\n }\n break;\n // case WAMP_MSG_SPEC.INTERRUPT:\n // // WAMP SPEC:\n // break;\n // case WAMP_MSG_SPEC.YIELD:\n // // WAMP SPEC:\n // break;\n default:\n this._hardClose('wamp.error.protocol_violation', 'Received non-compliant WAMP message');\n break;\n }\n }\n\n /**\n * Internal websocket on error callback\n * @param {object} error\n * @private\n */\n _wsOnError (error) {\n this._log('websocket error');\n\n if (this._cache.connectPromise) {\n this._cache.connectPromise.onError(error);\n this._cache.connectPromise = null;\n }\n\n if (this._options.onError) {\n this._options.onError({ error });\n }\n }\n\n /**\n * Reconnect to server in case of websocket error\n * @private\n */\n _wsReconnect () {\n this._log('websocket reconnecting...');\n\n if (this._options.onReconnect) {\n this._options.onReconnect();\n }\n\n this._cache.reconnectingAttempts++;\n this._ws = getWebSocket(this._url, this._protocols, this._options.ws,\n this._options.additionalHeaders, this._options.wsRequestOptions);\n this._initWsCallbacks();\n }\n\n /**\n * Resubscribe to topics in case of communication error\n * @private\n */\n _renewSubscriptions () {\n let i;\n const subs = this._subscriptions,\n st = this._subsTopics;\n\n this._subscriptions = {};\n this._subsTopics = new Set();\n\n for (let topic of st) {\n i = subs[topic].callbacks.length;\n while (i--) {\n this.subscribe(topic, subs[topic].callbacks[i], subs[topic].advancedOptions);\n }\n }\n }\n\n /**\n * Reregister RPCs in case of communication error\n * @private\n */\n _renewRegistrations () {\n const rpcs = this._rpcRegs,\n rn = this._rpcNames;\n\n this._rpcRegs = {};\n this._rpcNames = new Set();\n\n for (let rpcName of rn) {\n this.register(rpcName, rpcs[rpcName].callbacks[0]);\n }\n }\n\n /*************************************************************************\n * Wampy public API\n *************************************************************************/\n\n /**\n * Get or set Wampy options\n *\n * To get options - call without parameters\n * To set options - pass hash-table with options values\n *\n * @param {object} [opts]\n * @returns {*}\n */\n options (opts) {\n if (typeof (opts) === 'undefined') {\n return this._options;\n } else if (this._isPlainObject(opts)) {\n this._options = this._merge(this._options, opts);\n return this;\n }\n }\n\n /**\n * Get the status of last operation\n *\n * @returns {object} with 3 fields: code, error, reqId\n * code: 0 - if operation was successful\n * code > 0 - if error occurred\n * error: error instance containing details\n * reqId: last successfully sent request ID\n */\n getOpStatus () {\n return this._cache.opStatus;\n }\n\n /**\n * Get the WAMP Session ID\n *\n * @returns {string} Session ID\n */\n getSessionId () {\n return this._cache.sessionId;\n }\n\n /**\n * Connect to server\n * @param {string} [url] New url (optional)\n * @returns {Promise}\n */\n async connect (url) {\n let error;\n\n if (url) {\n this._url = url;\n }\n\n if (this._options.realm) {\n\n const authOpts = (this._options.authid ? 1 : 0) +\n ((this._isArray(this._options.authmethods) && this._options.authmethods.length) ? 1 : 0) +\n (typeof this._options.onChallenge === 'function' ||\n Object.keys(this._options.authPlugins).length ? 1 : 0);\n\n if (authOpts > 0 && authOpts < 3) {\n error = new Errors.NoCRACallbackOrIdError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n this._setWsProtocols();\n this._ws = getWebSocket(this._url, this._protocols, this._options.ws,\n this._options.additionalHeaders, this._options.wsRequestOptions);\n if (!this._ws) {\n error = new Errors.NoWsOrUrlError();\n this._fillOpStatusByError(error);\n throw error;\n }\n this._initWsCallbacks();\n\n } else {\n error = new Errors.NoRealmError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n let defer = getNewPromise();\n this._cache.connectPromise = defer;\n return defer.promise;\n }\n\n /**\n * Disconnect from server\n * @returns {Promise}\n */\n async disconnect () {\n if (this._cache.sessionId) {\n let defer = getNewPromise();\n this._cache.opStatus = SUCCESS;\n this._cache.closePromise = defer;\n // need to send goodbye message to server\n this._cache.isSayingGoodbye = true;\n this._send([WAMP_MSG_SPEC.GOODBYE, {}, 'wamp.close.system_shutdown']);\n\n return defer.promise;\n\n } else if (this._ws) {\n this._ws.close();\n }\n\n return true;\n }\n\n /**\n * Abort WAMP session establishment\n *\n * @returns {Wampy}\n */\n abort () {\n\n if (!this._cache.sessionId && this._ws.readyState === 1) {\n this._send([WAMP_MSG_SPEC.ABORT, {}, 'wamp.error.abort']);\n this._cache.sessionId = null;\n }\n\n this._ws.close();\n this._cache.opStatus = SUCCESS;\n\n return this;\n }\n\n /**\n * Subscribe to a topic on a broker\n *\n * @param {string} topicURI\n * @param {function} onEvent - received event callback\n * @param {object} [advancedOptions] - optional parameter. Must include any or all of the options:\n * { match: string matching policy (\"prefix\"|\"wildcard\") }\n *\n * @returns {Promise}\n */\n async subscribe (topicURI, onEvent, advancedOptions) {\n let reqId, patternBased = false;\n const options = {}, callbacks = getNewPromise();\n\n if (this._isPlainObject(advancedOptions)) {\n if (Object.prototype.hasOwnProperty.call(advancedOptions, 'match')) {\n if (/prefix|wildcard/.test(advancedOptions.match)) {\n options.match = advancedOptions.match;\n patternBased = true;\n } else {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n }\n } else if (typeof (advancedOptions) !== 'undefined') {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n // Need to be placed here as patternBased flag is determined above\n if (!this._preReqChecks({ topic: topicURI, patternBased: patternBased, allowWAMP: true },\n 'broker')) {\n throw this._cache.opStatus.error;\n }\n\n if (typeof onEvent === 'function') {\n callbacks.onEvent = onEvent;\n } else {\n let error = new Errors.NoCallbackError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n if (!this._subscriptions[topicURI] || !this._subscriptions[topicURI].callbacks.length) {\n // no such subscription or processing unsubscribing\n\n reqId = this._getReqId();\n\n this._requests[reqId] = {\n topic: topicURI,\n callbacks,\n advancedOptions\n };\n\n // WAMP SPEC: [SUBSCRIBE, Request|id, Options|dict, Topic|uri]\n this._send([WAMP_MSG_SPEC.SUBSCRIBE, reqId, options, topicURI]);\n\n } else { // already have subscription to this topic\n // There is no such callback yet\n if (this._subscriptions[topicURI].callbacks.indexOf(callbacks.onEvent) < 0) {\n this._subscriptions[topicURI].callbacks.push(callbacks.onEvent);\n }\n\n return {\n topic: topicURI,\n subscriptionId: this._subscriptions[topicURI].id\n };\n }\n\n this._cache.opStatus = SUCCESS;\n this._cache.opStatus.reqId = reqId;\n return callbacks.promise;\n }\n\n /**\n * Unsubscribe from topic\n * @param {string} topicURI\n * @param {function} [onEvent] - received event callback to remove (optional). If not provided -\n * all callbacks will be removed and unsubscribed on the server\n * @returns {Promise}\n */\n async unsubscribe (topicURI, onEvent) {\n let reqId;\n const callbacks = getNewPromise();\n\n if (!this._preReqChecks(null, 'broker')) {\n throw this._cache.opStatus.error;\n }\n\n if (this._subscriptions[topicURI]) {\n\n reqId = this._getReqId();\n\n if (typeof onEvent === 'function') {\n let i = this._subscriptions[topicURI].callbacks.indexOf(onEvent);\n if (i >= 0) {\n this._subscriptions[topicURI].callbacks.splice(i, 1);\n }\n } else {\n this._subscriptions[topicURI].callbacks = [];\n }\n\n if (this._subscriptions[topicURI].callbacks.length) {\n // There are another callbacks for this topic\n this._cache.opStatus = SUCCESS;\n return true;\n }\n\n this._requests[reqId] = {\n topic: topicURI,\n callbacks\n };\n\n // WAMP_SPEC: [UNSUBSCRIBE, Request|id, SUBSCRIBED.Subscription|id]\n this._send([WAMP_MSG_SPEC.UNSUBSCRIBE, reqId, this._subscriptions[topicURI].id]);\n\n } else {\n let error = new Errors.NonExistUnsubscribeError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n this._cache.opStatus = SUCCESS;\n this._cache.opStatus.reqId = reqId;\n return callbacks.promise;\n }\n\n /**\n * Publish an event to the topic\n * @param {string} topicURI\n * @param {string|number|Array|object} [payload] - can be either a value of any type or null or even omitted.\n * Also, it is possible to pass array and object-like data simultaneously.\n * In this case pass a hash-table with next attributes:\n * {\n * argsList: array payload (may be omitted)\n * argsDict: object payload (may be omitted)\n * }\n * @param {object} [advancedOptions] - optional parameter. Must include any or all of the options:\n * { exclude: integer|array WAMP session id(s) that won't receive a published event,\n * even though they may be subscribed\n * exclude_authid: string|array Authentication id(s) that won't receive\n * a published event, even though they may be subscribed\n * exclude_authrole: string|array Authentication role(s) that won't receive\n * a published event, even though they may be subscribed\n * eligible: integer|array WAMP session id(s) that are allowed\n * to receive a published event\n * eligible_authid: string|array Authentication id(s) that are allowed\n * to receive a published event\n * eligible_authrole: string|array Authentication role(s) that are allowed\n * to receive a published event\n * exclude_me: bool flag of receiving publishing event by initiator\n * disclose_me: bool flag of disclosure of publisher identity (its WAMP session ID)\n * to receivers of a published event }\n * @returns {Promise}\n */\n async publish (topicURI, payload, advancedOptions) {\n let reqId, msg;\n const options = { acknowledge: true }, callbacks = getNewPromise(),\n _optionsConvertHelper = (option, sourceType) => {\n if (advancedOptions[option]) {\n if (this._isArray(advancedOptions[option]) && advancedOptions[option].length) {\n options[option] = advancedOptions[option];\n } else if (typeof advancedOptions[option] === sourceType) {\n options[option] = [advancedOptions[option]];\n } else {\n return false;\n }\n }\n\n return true;\n };\n\n if (!this._preReqChecks({ topic: topicURI, patternBased: false, allowWAMP: false }, 'broker')) {\n throw this._cache.opStatus.error;\n }\n\n if (this._isPlainObject(advancedOptions)) {\n if (!_optionsConvertHelper('exclude', 'number') ||\n !_optionsConvertHelper('exclude_authid', 'string') ||\n !_optionsConvertHelper('exclude_authrole', 'string') ||\n !_optionsConvertHelper('eligible', 'number') ||\n !_optionsConvertHelper('eligible_authid', 'string') ||\n !_optionsConvertHelper('eligible_authrole', 'string')) {\n\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n if (Object.hasOwnProperty.call(advancedOptions, 'exclude_me')) {\n options.exclude_me = advancedOptions.exclude_me !== false;\n }\n\n if (Object.hasOwnProperty.call(advancedOptions, 'disclose_me')) {\n options.disclose_me = advancedOptions.disclose_me === true;\n }\n\n // Check and handle Payload PassThru Mode\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-passthru-mode\n let pptScheme = advancedOptions.ppt_scheme;\n\n if (pptScheme) {\n if (!this._checkPPTOptions('broker', advancedOptions)) {\n throw this._cache.opStatus.error;\n }\n\n options.ppt_scheme = pptScheme;\n\n if (advancedOptions.ppt_serializer) {\n options.ppt_serializer = advancedOptions.ppt_serializer;\n }\n if (advancedOptions.ppt_cipher) {\n options.ppt_cipher = advancedOptions.ppt_cipher;\n }\n if (advancedOptions.ppt_keyid) {\n options.ppt_keyid = advancedOptions.ppt_keyid;\n }\n }\n\n } else if (typeof (advancedOptions) !== 'undefined') {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n reqId = this._getReqId();\n\n this._requests[reqId] = {\n topic: topicURI,\n callbacks\n };\n\n // WAMP_SPEC: [PUBLISH, Request|id, Options|dict, Topic|uri]\n msg = [WAMP_MSG_SPEC.PUBLISH, reqId, options, topicURI];\n\n if (arguments.length > 1) {\n // WAMP_SPEC: [PUBLISH, Request|id, Options|dict, Topic|uri, Arguments|list (, ArgumentsKw|dict)]\n let res = this._packPPTPayload(payload, options);\n\n if (res.err) {\n throw this._cache.opStatus.error;\n }\n msg = msg.concat(res.payloadItems);\n }\n\n this._send(msg);\n this._cache.opStatus = SUCCESS;\n this._cache.opStatus.reqId = reqId;\n return callbacks.promise;\n }\n\n /**\n * Remote Procedure Call\n * @param {string} topicURI\n * @param {string|number|Array|object} [payload] - can be either a value of any type or null. Also, it\n * is possible to pass array and object-like data simultaneously.\n * In this case pass a hash-table with next attributes:\n * {\n * argsList: array payload (may be omitted)\n * argsDict: object payload (may be omitted)\n * }\n * @param {object} [advancedOptions] - optional parameter. Must include any or all of the options:\n * { disclose_me: bool flag of disclosure of Caller identity (WAMP session ID)\n * to endpoints of a routed call\n * progress_callback: function for handling progressive call results\n * timeout: integer timeout (in ms) for the call to finish\n * }\n * @returns {Promise}\n */\n async call (topicURI, payload, advancedOptions) {\n let reqId, msg;\n const options = {}, callbacks = getNewPromise();\n\n if (!this._preReqChecks({ topic: topicURI, patternBased: false, allowWAMP: true }, 'dealer')) {\n throw this._cache.opStatus.error;\n }\n\n if (this._isPlainObject(advancedOptions)) {\n if (Object.hasOwnProperty.call(advancedOptions, 'disclose_me')) {\n options.disclose_me = advancedOptions.disclose_me === true;\n }\n\n if (Object.hasOwnProperty.call(advancedOptions, 'progress_callback')) {\n if (typeof advancedOptions.progress_callback === 'function') {\n options.receive_progress = true;\n callbacks.onProgress = advancedOptions.progress_callback;\n } else {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n }\n\n if (Object.hasOwnProperty.call(advancedOptions, 'timeout')) {\n if (typeof advancedOptions.timeout === 'number') {\n options.timeout = advancedOptions.timeout;\n } else {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n }\n\n // Check and handle Payload PassThru Mode\n // @see https://wamp-proto.org/wamp_latest_ietf.html#name-payload-passthru-mode\n let pptScheme = advancedOptions.ppt_scheme;\n\n if (pptScheme) {\n if (!this._checkPPTOptions('dealer', advancedOptions)) {\n throw this._cache.opStatus.error;\n }\n\n options.ppt_scheme = pptScheme;\n\n if (advancedOptions.ppt_serializer) {\n options.ppt_serializer = advancedOptions.ppt_serializer;\n }\n if (advancedOptions.ppt_cipher) {\n options.ppt_cipher = advancedOptions.ppt_cipher;\n }\n if (advancedOptions.ppt_keyid) {\n options.ppt_keyid = advancedOptions.ppt_keyid;\n }\n }\n } else if (typeof (advancedOptions) !== 'undefined') {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n do {\n reqId = this._getReqId();\n } while (reqId in this._calls);\n\n this._calls[reqId] = callbacks;\n\n // WAMP SPEC: [CALL, Request|id, Options|dict, Procedure|uri, (Arguments|list, ArgumentsKw|dict)]\n msg = [WAMP_MSG_SPEC.CALL, reqId, options, topicURI];\n\n if (payload !== null && typeof (payload) !== 'undefined') {\n let res = this._packPPTPayload(payload, options);\n\n if (res.err) {\n throw this._cache.opStatus.error;\n }\n msg = msg.concat(res.payloadItems);\n }\n\n this._send(msg);\n this._cache.opStatus = SUCCESS;\n this._cache.opStatus.reqId = reqId;\n return callbacks.promise;\n }\n\n /**\n * RPC invocation cancelling\n *\n * @param {int} reqId RPC call request ID\n * @param {object} [advancedOptions] - optional parameter. Must include any or all of the options:\n * { mode: string|one of the possible modes:\n * \"skip\" | \"kill\" | \"killnowait\". Skip is default.\n * }\n *\n * @returns {Boolean}\n */\n cancel (reqId, advancedOptions) {\n const options = {};\n\n if (!this._preReqChecks(null, 'dealer')) {\n throw this._cache.opStatus.error;\n }\n\n if (!reqId || !this._calls[reqId]) {\n let error = new Errors.NonExistRPCReqIdError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n if (this._isPlainObject(advancedOptions)) {\n if (Object.hasOwnProperty.call(advancedOptions, 'mode')) {\n if (/skip|kill|killnowait/.test(advancedOptions.mode)) {\n options.mode = advancedOptions.mode;\n } else {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n }\n } else if (typeof (advancedOptions) !== 'undefined') {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n // WAMP SPEC: [CANCEL, CALL.Request|id, Options|dict]\n this._send([WAMP_MSG_SPEC.CANCEL, reqId, options]);\n this._cache.opStatus = SUCCESS;\n this._cache.opStatus.reqId = reqId;\n\n return true;\n }\n\n /**\n * RPC registration for invocation\n * @param {string} topicURI\n * @param {function} rpc - rpc that will receive invocations\n * @param {object} [advancedOptions] - optional parameter. Must include any or all of the options:\n * {\n * match: string matching policy (\"prefix\"|\"wildcard\")\n * invoke: string invocation policy (\"single\"|\"roundrobin\"|\"random\"|\"first\"|\"last\")\n * }\n * @returns {Promise}\n */\n async register (topicURI, rpc, advancedOptions) {\n let reqId, patternBased = false;\n const options = {}, callbacks = getNewPromise();\n\n if (this._isPlainObject(advancedOptions)) {\n if (Object.hasOwnProperty.call(advancedOptions, 'match')) {\n if (/prefix|wildcard/.test(advancedOptions.match)) {\n options.match = advancedOptions.match;\n patternBased = true;\n } else {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n }\n\n if (Object.hasOwnProperty.call(advancedOptions, 'invoke')) {\n if (/single|roundrobin|random|first|last/.test(advancedOptions.invoke)) {\n options.invoke = advancedOptions.invoke;\n } else {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n }\n\n } else if (typeof (advancedOptions) !== 'undefined') {\n let error = new Errors.InvalidParamError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n // Need to be placed here as patternBased flag is determined above\n if (!this._preReqChecks({ topic: topicURI, patternBased: patternBased, allowWAMP: false },\n 'dealer')) {\n throw this._cache.opStatus.error;\n }\n\n if (typeof rpc === 'function') {\n callbacks.rpc = rpc;\n } else {\n let error = new Errors.NoCallbackError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n if (!this._rpcRegs[topicURI] || !this._rpcRegs[topicURI].callbacks.length) {\n // no such registration or processing unregistering\n\n reqId = this._getReqId();\n\n this._requests[reqId] = {\n topic: topicURI,\n callbacks\n };\n\n // WAMP SPEC: [REGISTER, Request|id, Options|dict, Procedure|uri]\n this._send([WAMP_MSG_SPEC.REGISTER, reqId, options, topicURI]);\n this._cache.opStatus = SUCCESS;\n this._cache.opStatus.reqId = reqId;\n } else { // already have registration with such topicURI\n let error = new Errors.RPCAlreadyRegisteredError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n return callbacks.promise;\n }\n\n /**\n * RPC unregistration for invocation\n * @param {string} topicURI\n * @returns {Promise}\n */\n async unregister (topicURI) {\n let reqId;\n const callbacks = getNewPromise();\n\n if (!this._preReqChecks({ topic: topicURI, patternBased: false, allowWAMP: false }, 'dealer')) {\n throw this._cache.opStatus.error; }\n\n if (this._rpcRegs[topicURI]) { // there is such registration\n\n reqId = this._getReqId();\n\n this._requests[reqId] = {\n topic: topicURI,\n callbacks\n };\n\n // WAMP SPEC: [UNREGISTER, Request|id, REGISTERED.Registration|id]\n this._send([WAMP_MSG_SPEC.UNREGISTER, reqId, this._rpcRegs[topicURI].id]);\n this._cache.opStatus = SUCCESS;\n this._cache.opStatus.reqId = reqId;\n } else { // there is no registration with such topicURI\n let error = new Errors.NonExistRPCUnregistrationError();\n this._fillOpStatusByError(error);\n throw error;\n }\n\n return callbacks.promise;\n }\n}\n\nexport default Wampy;\nexport { Wampy, Errors };\n"],"mappings":";;;;;;;AAgBA;;AACA;;;;AACA;;AACA;;;;;;;;;;;;+CAlBA,oJ;;;;;;;;;;;;;;AAmBA,IAAMA,cAAc,GAAG,IAAIC,8BAAJ,EAAvB;AAEA;AACA;AACA;;IACMC,K;EAEF;AACJ;AACA;AACA;AACA;EACI,eAAaC,GAAb,EAAkBC,OAAlB,EAA2B;IAAA;;IAEvB;AACR;AACA;AACA;AACA;IACQ,KAAKC,OAAL,GAAe,YAAf;IAEA;AACR;AACA;AACA;AACA;;IACQ,KAAKC,IAAL,GAAa,OAAOH,GAAP,KAAe,QAAhB,GAA4BA,GAA5B,GAAkC,IAA9C;IAEA;AACR;AACA;AACA;AACA;;IACQ,KAAKI,UAAL,GAAkB,CAAC,aAAD,CAAlB;IAEA;AACR;AACA;AACA;AACA;;IACQ,KAAKC,cAAL,GAAsB;MAClBC,KAAK,EAAE,cAAc,KAAKJ,OADR;MAElBK,KAAK,EAAE;QACHC,SAAS,EAAG;UACRC,QAAQ,EAAE;YACNC,6BAA6B,EAAE,IADzB;YAENC,mBAAmB,EAAY,IAFzB;YAGNC,wBAAwB,EAAO,IAHzB;YAINC,qBAAqB,EAAU;UAJzB;QADF,CADT;QASHC,UAAU,EAAE;UACRL,QAAQ,EAAE;YACNM,0BAA0B,EAAE,IADtB;YAENC,uBAAuB,EAAK,IAFtB;YAGNJ,wBAAwB,EAAI,IAHtB;YAINC,qBAAqB,EAAO;UAJtB;QADF,CATT;QAiBHI,MAAM,EAAM;UACRR,QAAQ,EAAE;YACNS,qBAAqB,EAAK,IADpB;YAENC,wBAAwB,EAAE,IAFpB;YAGNC,cAAc,EAAY,IAHpB;YAINC,YAAY,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,MAAL,CAAYK,QAAZ,GAAuByH,kBAAvB;gBACA,KAAK9H,MAAL,CAAYK,QAAZ,CAAqBH,KAArB,GAA6BA,KAA7B;gBAnBR;gBAAA;;cAAA;gBAoBgB;gBACJK,KArBZ,GAqBoB,IAAIgE,MAAM,CAAC+K,8BAAX,EArBpB;;gBAsBQ,KAAK5K,oBAAL,CAA0BnE,KAA1B;;gBAtBR,MAuBcA,KAvBd;;cAAA;gBAAA,mCA0BW2K,SAAS,CAAC6C,OA1BrB;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;;;;;eA8BW1P,K"} \ No newline at end of file diff --git a/package.json b/package.json index feda183..352f6dc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wampy", - "version": "7.0.0", + "version": "7.0.0-rc1", "description": "Simple WAMP (WebSocket Application Messaging Protocol) Javascript implementation", "author": "Konstantin Burkalev (https://ksdaemon.ru)", "devDependencies": { diff --git a/src/wampy.js b/src/wampy.js index e34170f..e855804 100644 --- a/src/wampy.js +++ b/src/wampy.js @@ -37,7 +37,7 @@ class Wampy { * @type {string} * @private */ - this.version = 'v7.0.0'; + this.version = 'v7.0.0-rc1'; /** * WS Url