2
0
mirror of https://github.com/tenrok/vue-native-websocket.git synced 2026-06-20 06:10:34 +03:00
This commit is contained in:
Metin Seylan
2016-10-29 00:47:04 +03:00
parent 88d8479209
commit 7f5fac27d0
16 changed files with 198 additions and 440 deletions
+5 -10
View File
@@ -1,24 +1,21 @@
# Vue-Socket.io
socket.io implemantation for vuejs
note: this repo for vuejs 1, vuejs 2 soon
socket.io implemantation for Vuejs 2.0 and 1.0
## Install
``` bash
npm install vue-socket.io --save
```
or
for Vue 1.0
``` bash
bower install vue-socket.io
npm install vue-socket.io@1.0.2 --save
```
## Usage
``` js
import VueSocketio from 'vue-socket.io'; // for ES6
// var VueSocketio = require('vue-socket.io') // for commonjs
import VueSocketio from 'vue-socket.io';
Vue.use(VueSocketio, 'http://socketserver.com:1923'); // Automaticly socket connect from url string
@@ -35,7 +32,7 @@ var vm = new Vue({
connect: function(){
console.log('socket connected')
},
customEmit: function(){
customEmit: function(val){
console.log('this method fired by socket server. eg: io.emit("customEmit", data)')
}
},
@@ -53,7 +50,5 @@ var vm = new Vue({
[Simple Chat App](http://metinseylan.com/vuesocketio/)
## License
[WTFPL](http://www.wtfpl.net/)