0.0.2-beta • Published 7 years ago

vue-ws v0.0.2-beta

Weekly downloads
32
License
MIT
Repository
-
Last release
7 years ago

Vue-Socket

Introduction

Vue-socket is a websocket plugin for Vue.js. It inject websocket lifecycle events into components, like open, close, error, and also it simplify event binding of message event. Support for Typescript.

Warning

The data structure of message event's data property should be like {type: "ping", data: {}}.

Install

npm install vue-ws

Usage

entry file

import VueSocket from "vue-ws";
Vue.use(VueSocket);

component

import Vue from "vue";
export default Vue.extend({
    onWebSocketOpen(){
        console.log("opened");
    },
    onWebSocketMsg: {
        ping(){
            console.log("pong");
        }
    }
});

License

This package is published under MIT license.

0.0.2-beta

7 years ago

0.0.1-beta

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago