From 54a8ff8f8c01f2ffaad07259da49447fdddd446f Mon Sep 17 00:00:00 2001 From: Leonardo Dominguez Date: Tue, 16 Apr 2019 11:25:08 -0400 Subject: [PATCH] update: readme --- README.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/README.md b/README.md index f8f45c8..e725fe9 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ connection|String/Socket.io-client|`null`|Required|Websocket server url or socke vuex.store|Vuex|`null`|Optional|Vuex store instance vuex.actionPrefix|String|`null`|Optional|Prefix for emitting server side vuex actions vuex.mutationPrefix|String |`null`|Optional|Prefix for emitting server side vuex mutations +vuex.options.useConnectionNamespace |Boolean|`false`|Optional|Use more than one connection namespace #### 🌈 Component Level Usage @@ -147,6 +148,41 @@ export default new Vuex.Store({ }) ``` +#### 🏆 Connection Namespace +

When you need to handle more than one namespaced connection, you need to set the `useConnectionNamespace` property of +the options object to true. What this does is telling the plugin that you are going to be using more than one namespaced connection and you want to put every connection in their own `$socket` key.

+ +``` javascript +import Vue from 'vue' +import store from './store' +import App from './App.vue' +import VueSocketIO from 'vue-socket.io' + +Vue.use(new VueSocketIO({ + debug: true, + connection: 'http://metinseylan.com:1992/mynamespace', + vuex: { + store, + options: { + useConnectionNamespace: true + } + }, + options: { path: "/my-app/" } //Optional options +})) + +new Vue({ + router, + store, + render: h => h(App) +}).$mount('#app') +``` + +Then use it like this: + +``` javascript +Vue.$socket.mynamespace.emit('emit_method', data) +``` + ## Stargazers over time [![Stargazers over time](https://starcharts.herokuapp.com/MetinSeylan/Vue-Socket.io.svg)](https://starcharts.herokuapp.com/MetinSeylan/Vue-Socket.io)