vue-nes
vue plugin support for hapi-nes
You can use this plugin to add NES(websocket for hapijs) support to your vue application. The messages pass through the synced store, and you can get those messages at anywhere.
requirements
- vuex
Usage
Example:
// vuejs boot file // usually websocket url is localhost:const wsUrl = `ws://`Vue // store generator const store = actions getters modules: nes: socketVuexModule strict: true // in components// Register component scoped subscriptions// We can get messages from store when we're in the component<template> <div> messagecode </div></template> <script> nes: subscribe: '/item/6' // you can receive from this subscription on this component, and all child components. computed: { this$storestatenesmessage // you can get broadcast messages from server at here } </script>
development
git clone https://github.com/eseom/vue-nes
cd vue-nes
yarn
yarn link
yarn watch
# (and open a new terminal)
cd /path/to/your_vue_project
yarn link vue-nes
# enjoy it