mirror of
https://github.com/MetinSeylan/Vue-Socket.io.git
synced 2025-04-16 15:21:28 +02:00
README.MD Example Usage Updates (#198)
* Fix Spelling - Rename `Listenler` to `Listener` * Add Options to Connection - Add options which can be passed to connection string for `SocketIO` * Build New Version * Fix spelling in Package.json - Change `implemantation` to `implementation` - Change `vuejs` to `Vue.js` - Change `vuex` to `VueX` * Updates to index.js - Add `options` to JSDocs for constructor - Fix spelling for JSDoc on `install` and `connect` methods * Update README.MD - Add example of connecting using socket.io-client instance * Update README.MD - Add options example using connection string * Update README.MD - Add options example using connection string * Remove unnecessary white space
This commit is contained in:
parent
f1e03525c0
commit
381cb5fdd0
1 changed files with 30 additions and 2 deletions
32
README.md
32
README.md
|
@ -27,7 +27,7 @@ are you looking for old documentation? <a href="https://github.com/MetinSeylan/V
|
|||
``` bash
|
||||
npm install vue-socket.io --save
|
||||
```
|
||||
|
||||
##### Using Connection String
|
||||
``` javascript
|
||||
import Vue from 'vue'
|
||||
import store from './store'
|
||||
|
@ -41,7 +41,8 @@ Vue.use(new VueSocketIO({
|
|||
store,
|
||||
actionPrefix: 'SOCKET_',
|
||||
mutationPrefix: 'SOCKET_'
|
||||
}
|
||||
},
|
||||
options: { path: "/my-app/" } //Optional options
|
||||
}))
|
||||
|
||||
new Vue({
|
||||
|
@ -51,6 +52,33 @@ new Vue({
|
|||
}).$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'
|
||||
|
||||
const options = { path: '/my-app/' }; //Options object to pass into SocketIO
|
||||
|
||||
Vue.use(new VueSocketIO({
|
||||
debug: true,
|
||||
connection: SocketIO('http://metinseylan.com:1992', options), //options object is Optional
|
||||
vuex: {
|
||||
store,
|
||||
actionPrefix: "SOCKET_",
|
||||
mutationPrefix: "SOCKET_"
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
render: h => h(App)
|
||||
}).$mount('#app')
|
||||
```
|
||||
|
||||
**Parameters**|**Type's**|**Default**|**Required**|**Description**
|
||||
-----|-----|-----|-----|-----
|
||||
debug|Boolean|`false`|Optional|Enable logging for debug
|
||||
|
|
Loading…
Add table
Reference in a new issue