mirror of
https://github.com/MetinSeylan/Vue-Socket.io.git
synced 2025-04-16 15:21:28 +02:00
update: readme
This commit is contained in:
parent
2f68c7c9b0
commit
54a8ff8f8c
1 changed files with 36 additions and 0 deletions
36
README.md
36
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
|
||||
<p>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.</p>
|
||||
|
||||
``` 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
|
||||
|
||||
[](https://starcharts.herokuapp.com/MetinSeylan/Vue-Socket.io)
|
||||
|
|
Loading…
Add table
Reference in a new issue