because shithub doesnt have ipv6 support
Find a file
Metin Seylan c7491fc762 Merge pull request #15 from whitekkk/master
add import vue in readme
2016-11-28 09:37:24 +03:00
dist missing events & build 2016-11-23 13:59:51 +03:00
src missing events & build 2016-11-23 13:59:51 +03:00
.gitignore v2 2016-10-29 00:47:04 +03:00
package.json Update package.json 2016-11-23 14:06:56 +03:00
README.md add import vue in readme 2016-11-28 08:53:05 +07:00
webpack.config.js v2 2016-10-29 00:47:04 +03:00

Vue-Socket.io

socket.io implemantation for Vuejs 2.0 and 1.0

Install

npm install vue-socket.io --save

for Vue 1.0

npm install vue-socket.io@1.0.2 --save

Usage

import Vue from 'vue';
import VueSocketio from 'vue-socket.io';

Vue.use(VueSocketio, 'http://socketserver.com:1923'); // Automaticly socket connect from url string

/*
  import socketio from 'socket.io-client';

  var ioInstance = socketio('http://socketserver.com:1923');

  Vue.use(VueSocketio, ioInstance); // bind custom socketio instance
*/

var vm = new Vue({
  sockets:{
    connect: function(){
      console.log('socket connected')
    },
    customEmit: function(val){
      console.log('this method fired by socket server. eg: io.emit("customEmit", data)')
    }
  },
  methods: {
    clickButton: function(val){
        // $socket is socket.io-client instance
        this.$socket.emit('emit_method', val);
    }
  }
})

Example

Realtime Car Tracker System

Simple Chat App

License

WTFPL