add: namespace name property to options object

This commit is contained in:
Leonardo Dominguez 2019-05-05 12:08:39 -04:00
parent b88edd089e
commit 57d422f7c1

View file

@ -17,7 +17,8 @@ export default class VueSocketIO {
Logger.debug = debug; Logger.debug = debug;
this.io = this.connect(connection, options); this.io = this.connect(connection, options);
this.useConnectionNamespace = (options && options.useConnectionNamespace) || false; this.useConnectionNamespace = (options && options.useConnectionNamespace);
this.namespaceName = (options && options.namespaceName);
this.emitter = new Emitter(vuex); this.emitter = new Emitter(vuex);
this.listener = new Listener(this.io, this.emitter); this.listener = new Listener(this.io, this.emitter);
@ -29,7 +30,7 @@ export default class VueSocketIO {
*/ */
install(Vue){ install(Vue){
const namespace = this.io.nsp.replace("/", ""); const namespace = this.namespaceName || this.io.nsp.replace("/", "");
if (this.useConnectionNamespace) { if (this.useConnectionNamespace) {
if (typeof Vue.prototype.$socket === "object") { if (typeof Vue.prototype.$socket === "object") {