Update README.MD

- Add example of connecting using socket.io-client instance
This commit is contained in:
eevabec 2019-03-06 10:41:38 -06:00
parent 1796309fdc
commit 3fb67d42bc

View file

@ -27,7 +27,7 @@ are you looking for old documentation? <a href="https://github.com/MetinSeylan/V
``` bash ``` bash
npm install vue-socket.io --save npm install vue-socket.io --save
``` ```
##### Using Connection String
``` javascript ``` javascript
import Vue from 'vue' import Vue from 'vue'
import store from './store' import store from './store'
@ -51,6 +51,34 @@ new Vue({
}).$mount('#app') }).$mount('#app')
``` ```
##### Using socket.io-client Instance
``` 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: SocketIO('http://metinseylan.com:1992', {
path: '/my-app/'
}),
vuex: {
store,
actionPrefix: "SOCKET_",
mutationPrefix: "SOCKET_"
}
})
);
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
```
**Parameters**|**Type's**|**Default**|**Required**|**Description** **Parameters**|**Type's**|**Default**|**Required**|**Description**
-----|-----|-----|-----|----- -----|-----|-----|-----|-----
debug|Boolean|`false`|Optional|Enable logging for debug debug|Boolean|`false`|Optional|Enable logging for debug