Vue-Socket.io 0,1

socket.io implemantation for vuejs

Vue-Socket.io

socket.io implemantation for vuejs

Install

  npm install vue-socket.io --save

or

  bower install vue-socket.io

Usage

import VueSocketio from 'vue-socket.io'; // for ES6

// var VueSocketio = require('vue-socket.io') // for commonjs

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(){
      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

Related Repositories

real-time-analytics-node-socketio-vuejs

real-time-analytics-node-socketio-vuejs

Creating a real-time website analytics dashboard with NodeJs, Socket.io, and Vue.js ...

Vue-Socket.io

Vue-Socket.io

socket.io implemantation for vuejs ...

vue-websocket

vue-websocket

Simple websocket (socket.io) plugin for Vue.js ...

vue-socket.io

vue-socket.io

这是一个用vue.js 和 socket.io 写的聊天室应用。简单易懂,很容易上手。 ...

generator-grail

generator-grail

Yeoman Generator for a modular One Page Application with Gulp, CoffeeScript, Stylus, Browserify, BrowserSync and Mocha. Vue.js, jQuery, Semantic-UI, Socket.IO, Fastclick, Cheerio and Should.js optional on top. Minimal Express.js, Mongoose and Socket.IO Se ...


Top Contributors

MetinSeylan