mirror of
https://github.com/MetinSeylan/Vue-Socket.io.git
synced 2025-04-16 15:21:28 +02:00
readme
This commit is contained in:
parent
8e0100be09
commit
0c778d661f
1 changed files with 4 additions and 4 deletions
|
@ -15,7 +15,7 @@ npm install vue-socket.io --save
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
##### Configration
|
#### Configration
|
||||||
Automaticly socket connect from url string
|
Automaticly socket connect from url string
|
||||||
``` js
|
``` js
|
||||||
Vue.use(VueSocketio, 'http://socketserver.com:1923');
|
Vue.use(VueSocketio, 'http://socketserver.com:1923');
|
||||||
|
@ -32,7 +32,7 @@ import store from './yourstore'
|
||||||
Vue.use(VueSocketio, socketio('http://socketserver.com:1923'), store);
|
Vue.use(VueSocketio, socketio('http://socketserver.com:1923'), store);
|
||||||
```
|
```
|
||||||
|
|
||||||
##### On Vuejs instance usage
|
#### On Vuejs instance usage
|
||||||
``` js
|
``` js
|
||||||
var vm = new Vue({
|
var vm = new Vue({
|
||||||
sockets:{
|
sockets:{
|
||||||
|
@ -52,7 +52,7 @@ var vm = new Vue({
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Dynamic socket event listenlers
|
#### Dynamic socket event listenlers
|
||||||
Create new listenler
|
Create new listenler
|
||||||
``` js
|
``` js
|
||||||
this.$options.sockets.event_name = (data) => {
|
this.$options.sockets.event_name = (data) => {
|
||||||
|
@ -64,7 +64,7 @@ Remove exist listenler
|
||||||
delete this.$options.sockets.event_name;
|
delete this.$options.sockets.event_name;
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Vuex Store integration
|
#### Vuex Store integration
|
||||||
Example store, socket mutations always have "SOCKET_" prefix
|
Example store, socket mutations always have "SOCKET_" prefix
|
||||||
``` js
|
``` js
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
Loading…
Add table
Reference in a new issue