Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- index d6f7254..314644e 100644
- --- a/wampy.js
- +++ b/home/grizmio/forked/wampy.js/src/wampy.js
- @@ -413,7 +413,9 @@ class Wampy {
- * @private
- */
- _validateURI (uri) {
- - const re = /^([0-9a-zA-Z_]+\.)*([0-9a-zA-Z_]+)$/;
- + // const re = /^([0-9a-zA-Z_]+\.)*([0-9a-zA-Z_]+)$/;
- + // {1,2} para soportar {match: wildcard} foo.bar..baz
- + const re = /^([0-9a-zA-Z_]+\.{1,2})*([0-9a-zA-Z_]+)$/;
- return !(!re.test(uri) || uri.indexOf('wamp') === 0);
- }
- @@ -1115,16 +1117,21 @@ class Wampy {
- * { onSuccess: will be called when subscribe would be confirmed
- * onError: will be called if subscribe would be aborted
- * onEvent: will be called on receiving published event }
- + * @param {object} options options like { match: wildcard }
- *
- * @returns {Wampy}
- */
- - subscribe (topicURI, callbacks) {
- + subscribe (topicURI, callbacks, options) {
- let reqId;
- if (!this._preReqChecks(topicURI, 'broker', callbacks)) {
- return this;
- }
- + if ( typeof options === 'undefined' ){
- + options = {};
- + }
- +
- if (typeof callbacks === 'function') {
- callbacks = { onEvent: callbacks };
- } else if (!this._isPlainObject(callbacks) || typeof (callbacks.onEvent) === 'undefined') {
- @@ -1148,7 +1155,7 @@ class Wampy {
- };
- // WAMP SPEC: [SUBSCRIBE, Request|id, Options|dict, Topic|uri]
- - this._send([WAMP_MSG_SPEC.SUBSCRIBE, reqId, {}, topicURI]);
- + this._send([WAMP_MSG_SPEC.SUBSCRIBE, reqId, options, topicURI]);
- } else { // already have subscription to this topic
- // There is no such callback yet
Add Comment
Please, Sign In to add comment