Skip to content

Commit 381cb5f

Browse files
evanbechtolMetinSeylan
authored andcommitted
README.MD Example Usage Updates (MetinSeylan#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
1 parent f1e0352 commit 381cb5f

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ are you looking for old documentation? <a href="https://github.com/MetinSeylan/V
2727
``` bash
2828
npm install vue-socket.io --save
2929
```
30-
30+
##### Using Connection String
3131
``` javascript
3232
import Vue from 'vue'
3333
import store from './store'
@@ -41,7 +41,8 @@ Vue.use(new VueSocketIO({
4141
store,
4242
actionPrefix: 'SOCKET_',
4343
mutationPrefix: 'SOCKET_'
44-
}
44+
},
45+
options: { path: "/my-app/" } //Optional options
4546
}))
4647

4748
new Vue({
@@ -51,6 +52,33 @@ new Vue({
5152
}).$mount('#app')
5253
```
5354

55+
##### Using socket.io-client Instance
56+
``` javascript
57+
import Vue from 'vue'
58+
import store from './store'
59+
import App from './App.vue'
60+
import VueSocketIO from 'vue-socket.io'
61+
62+
const options = { path: '/my-app/' }; //Options object to pass into SocketIO
63+
64+
Vue.use(new VueSocketIO({
65+
debug: true,
66+
connection: SocketIO('http://metinseylan.com:1992', options), //options object is Optional
67+
vuex: {
68+
store,
69+
actionPrefix: "SOCKET_",
70+
mutationPrefix: "SOCKET_"
71+
}
72+
})
73+
);
74+
75+
new Vue({
76+
router,
77+
store,
78+
render: h => h(App)
79+
}).$mount('#app')
80+
```
81+
5482
**Parameters**|**Type's**|**Default**|**Required**|**Description**
5583
-----|-----|-----|-----|-----
5684
debug|Boolean|`false`|Optional|Enable logging for debug

0 commit comments

Comments
 (0)