Socket
Socket
Sign inDemoInstall

vue-simple-socket

Package Overview
Dependencies
27
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue-simple-socket

A simple Vue wrapper on email-validator, providing an easy way to validate email syntax


Version published
Maintainers
1
Created

Readme

Source

Vue Simple Socket

A simple Vue wrapper on socket.io-client, providing an easy way to use sockets

Installing

Using npm :

npm install vue-simple-socket

Using yarn :

yarn add vue-simple-socket

Setup

Import ES6 module style :

import Vue from 'vue'
import SimpleSocket from 'vue-simple-socket'

Or CommonJS style :

const Vue = require('vue')
  , SimpleSocket = require('vue-simple-socket')

Or AMD style :

define(['vue', 'vue-simple-socket'], function(Vue, SimpleSocket) {})

Or even <script> style :

<script src="http://path/to/vue.js"></script>
<script src="http://path/to/vue-simple-socket/index.js"></script>

Then provide SimpleSocket to the use() function of Vue (not needed for <script> style) :

Vue.use(SimpleSocket)

Useage

You can now use $socket in your Vue instances and components

new Vue({
  created() {
    this.$socket.on('myEvent', (data) => { // Do something with data })
  }
  , destroyed() {
    this.$socket.off('myEvent') // Unsubscribe if you load your components dynamically
  }
})

Dependencies

  • socket.io-client - Realtime application framework (client)

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Keywords

FAQs

Last updated on 13 May 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc