mirror of
https://github.com/MetinSeylan/Vue-Socket.io.git
synced 2025-04-16 15:21:28 +02:00
commit
6f16d6c0b4
1 changed files with 6 additions and 6 deletions
12
README.md
12
README.md
|
@ -15,8 +15,8 @@ npm install vue-socket.io --save
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
#### Configration
|
#### Configuration
|
||||||
Automaticly socket connect from url string
|
Automatic socket connection from an URL string
|
||||||
``` js
|
``` js
|
||||||
Vue.use(VueSocketio, 'http://socketserver.com:1923');
|
Vue.use(VueSocketio, 'http://socketserver.com:1923');
|
||||||
```
|
```
|
||||||
|
@ -40,7 +40,7 @@ var vm = new Vue({
|
||||||
console.log('socket connected')
|
console.log('socket connected')
|
||||||
},
|
},
|
||||||
customEmit: function(val){
|
customEmit: function(val){
|
||||||
console.log('this method fired by socket server. eg: io.emit("customEmit", data)')
|
console.log('this method was fired by the socket server. eg: io.emit("customEmit", data)')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -52,14 +52,14 @@ var vm = new Vue({
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Dynamic socket event listenlers
|
#### Dynamic socket event listeners
|
||||||
Create new listenler
|
Create a new listener
|
||||||
``` js
|
``` js
|
||||||
this.$options.sockets.event_name = (data) => {
|
this.$options.sockets.event_name = (data) => {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
Remove exist listenler
|
Remove existing listener
|
||||||
``` js
|
``` js
|
||||||
delete this.$options.sockets.event_name;
|
delete this.$options.sockets.event_name;
|
||||||
```
|
```
|
||||||
|
|
Loading…
Add table
Reference in a new issue