vue-pusher
Pusher plugin for vue.js
102,621
43
| Install | |
|---|---|
npm install vue-pusher |
|
| Latest Version: | 1.1.0 |
| License: | MIT |
| Last Updated: | Nov 21, 2020 |
| Links: | GitHub · npm |
Maintainer: joshuacerbito
Vue Pusher
A pusher plugin for vue.js
Usage
Install the plugin like any other plugin. :)
var Vue = require('vue');
Vue.use(require('vue-pusher'), {
api_key: 'xxxxxx',
options: {
cluster: 'ap1',
encrypted: true,
}
});
Manually using the pusher instance.
Inside your components, you just need to access the $pusher object.
export default {
ready () {
var channel = this.$pusher.subscribe('dashboard');
channel.bind('user.log', ({ log }) => {
console.log(`User ${log.user.name} has ${log.action} at ${log.time}`);
});
}
}
Subscribing to a channel.
Subscribing to a channel providers a callback where you can bind events.
this.$pusher.subscribe('dashboard', channel => {
channel.bind('user.log', ({ log }) => {
console.log(`User ${log.user.name} has ${log.action} at ${log.time}`);
});
});
Unsubscribing to a channel.
this.$pusher.unsubscribe('dashboard');
Related Packages
@arkstack/realtime
Client for consuming Arkstack realtime notifications (Pusher/Firebase), with fra...
9,305
6
vue-echo-laravel
It's a laravel/echo wrapper for Vue JS ^2.0. This Vue plugin injects a Laravel E...
73,081
20
Version History
| Version | Released | License |
|---|---|---|
| 1.1.0 | MIT | |
| 1.0.0 | MIT | |
| 0.2.1 | MIT | |
| 0.2.0 | MIT | |
| 0.1.1 | MIT | |
| 0.1.0 | MIT | |
| 0.0.0 | MIT |